hsx
v0.0.5
Sites HTML statiques avec JSX, SASS et WebPack (pas de réaction).
webpack est incroyablement puissantwebpack ) offre des avantages distincts par rapport à gulp / grunt hsx est un CLI pour échafaudager un nouveau projet (voir le modèle). Une brève description de ce qu'il y a suit:
webpack2string-dompostcss (avec autoprefixer et rucksack )imageminwebpack-dev-serverMain câblépackage.json avec quelques npm scripts utiles $ npm i hsx -gPour créer un nouveau projet:
# 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 devEnsuite, dans votre navigateur: http: // localhost: 3000 /
Notez le repère à babel pour transformer JSX en appels de fonction sd , au lieu 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