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 >
) MIT © 2017 Michael Cavalea