hsx
v0.0.5
Статические HTML -сайты с JSX, SASS и WebPack (без реагирования).
webpack безумно мощныйwebpack ) предлагает четкие преимущества по сравнению с gulp / grunt hsx является CLI для строительства нового проекта (см. Шаблон). Краткое описание того, что находится внутри, следует:
webpack2string-dompostcss (с autoprefixer и rucksack )imageminwebpack-dev-serverMain компонент подключенияpackage.json с некоторыми полезными npm scripts $ npm i hsx -gЧтобы создать новый проект:
# 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 devЗатем в вашем браузере: http: // localhost: 3000/
Обратите внимание на сигнал в babel , чтобы преобразовать JSX в вызовы функций sd , а не 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 >
) Грань © 2017 Michael Cavalea