hsx
v0.0.5
Sites HTML estáticos com JSX, SASS e Webpack (sem reação).
webpack é incrivelmente poderosowebpack ) oferece vantagens distintas sobre gulp / grunt hsx é uma CLI para andaimes de um novo projeto (consulte o modelo). Uma breve descrição do que está dentro segue:
webpack2string-dompostcss (com autoprefixer e rucksack )imageminwebpack-dev-serverMain conectadopackage.json com alguns npm scripts úteis $ npm i hsx -gPara criar um novo projeto:
# 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 devEntão, no seu navegador: http: // localhost: 3000/
Observe a sugestão de babel para transformar o JSX em chamadas de função sd , em vez de 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