Small front-end engineering modular development scaffolding
npm i cwhtml -g
cwhtml create <dir>
cwhtml build
cwhtml dev
.cwhtmlrc
cwhtml-project
|
|-- dist
|
|-- src
| |-- component
| | |-- header /* auto import style and js */
| | | |-- index.tpl
| | | |-- index.scss
| | | |-- index.js
| |
| |-- data /* page render data */
| | |-- index.js
| |
| |-- image
| | |-- banner.png
| |
| |-- sprite
| | |-- index
| | | |-- icon.png
| |
| |-- layout
| | |-- common.tpl
| |
| |-- page /* entry */
| | |-- index.tpl
| |
| |-- script
| | |-- index.js
| |
| |-- style
| | |-- index.scss /* free choice css sass less */
| |
| |-- iconfont
| | |-- font.eot
| | |-- font.woff
| | |-- font.woff2
| | |-- font.svg
| |
| |-- favicon.ico
{{extend './layout.tpl'}}
auto include src/component/header/*
{{include header}}
{{block content}}
<h1>sub conetnt</h1>
{{/block}}
Key and item are keywords
{{each from=data}}
<li data-key="{{key}}"> {{item.name}}</li>
{{/each}}
does not support boolean
{{if a=1}}
<h1>true</h1>
#{{else}}
<h2>false</h2>
{{/if}}
{{if c=case}}
<h1>case</h1>
{{elseif c=which}}
<h2>which</h2>
{{/if}}
{{set a=1}}
{{a}}
support css sass less
{{style '../style/index.scss'}}
{{script '../js/index.js'}}
root: './src',
output: './dist'
extname: '.tpl'