hsx
v0.0.5
Situs HTML statis dengan JSX, Sass, dan Webpack (tidak bereaksi).
webpack sangat kuatwebpack ) menawarkan keunggulan berbeda dibandingkan gulp / grunt hsx adalah CLI untuk perancah proyek baru (lihat template). Deskripsi singkat tentang apa yang di dalam berikut:
webpack2 Swagstring-dompostcss (dengan autoprefixer dan rucksack ))imageminwebpack-dev-serverMain kabel-uppackage.json dengan beberapa npm scripts yang berguna $ npm i hsx -gUntuk membuat proyek baru:
# using node and npm
# install hsx globally
$ npm install hsx -g
# use the hsx command from the CLI to scaffold a project
# template files are copied to the CWD, unless a path is specified
$ hsx [path]
$ npm i
$ npm run devKemudian, di browser Anda: http: // localhost: 3000/
Perhatikan isyarat untuk babel untuk mengubah JSX menjadi panggilan fungsi sd , alih -alih React.createElement .
import sd from 'string-dom'
/** @jsx sd */
// create a simple Div component
// children is the HTML wrapped by the element
const Div = ( { children , name } ) => (
< div class = { name } >
{ children }
</ div >
)
// render it to the DOM, with some inner content
document . body . innerHTML += (
< Div name = "site" >
< h1 > hsx </ h1 >
< p > This is inside the Div component! </ p >
</ Div >
) Mit. © 2017 Michael Cavalea