hsx
v0.0.5
JSX, SASS 및 웹 팩이있는 정적 HTML 사이트 (반응 없음).
webpack 미친 듯이 강력합니다grunt Bundler ( webpack gulp 가있는 정적 사이트 구축 hsx 는 새로운 프로젝트를 스캐 폴딩하기위한 CLI입니다 (템플릿 참조). 내부의 내용에 대한 간단한 설명은 다음과 같습니다.
webpack2 설정string-dom 통해 JSX에서 정적 HTML을 사용합니다postcss ( autoprefixer 및 rucksack 포함)imagemin 통한 이미지 압축webpack-dev-server 로 구동되는 로컬 서버Main 구성 요소npm scripts 포함 된 package.json $ 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/
jsx를 React.createElement 대신 sd 함수 호출로 변환하기 위해 babel 에 대한 큐에 주목하십시오.
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