hsx
v0.0.5
Statische HTML -Sites mit JSX, SASS und Webpack (kein Reaktieren).
webpack ist wahnsinnig mächtigwebpack ) bietet unterschiedliche Vorteile gegenüber gulp / grunt hsx ist eine CLI für das Gerüst eines neuen Projekts (siehe Vorlage). Eine kurze Beschreibung dessen, was sich darin befindet, folgt:
webpack2 -Setupstring-dompostcss (mit autoprefixer und rucksack )imageminwebpack-dev-server betrieben wirdMainpackage.json mit einigen nützlichen npm scripts $ npm i hsx -gUm ein neues Projekt zu erstellen:
# 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 devDann in Ihrem Browser: http: // localhost: 3000/
Beachten Sie den Hinweis auf babel , um JSX in sd -Funktionsaufrufe zu verwandeln, anstatt zu 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