hsx
v0.0.5
带有JSX,SASS和WebPack的静态HTML站点(无反应)。
webpack非常强大webpack )建造静态站点(WebPack)提供了与gulp / grunt不同优势hsx是用于脚手架新项目的CLI(请参阅模板)。内部内容的简要说明如下:
webpack2设置string-dompostcss (带有autoprefixer和rucksack )imageminwebpack-dev-server驱动的本地服务器Main组件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