hsx
v0.0.5
Static HTML sites with JSX, Sass, and webpack (no React).
webpack is insanely powerfulwebpack) offers distinct advantages over gulp/grunthsx is a CLI for scaffolding a new project (see the template). A brief description of what's inside follows:
webpack2 setup
string-dompostcss (with autoprefixer and rucksack)imageminwebpack-dev-serverMain componentpackage.json with some useful npm scripts$ npm i hsx -gTo create a new project:
# 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 devThen, in your browser: http://localhost:3000/
Note the cue to babel to transform JSX into sd function calls, instead of 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