https://github.com/chowa/cwhtml
Small front-end engineering modular development scaffolding
https://github.com/chowa/cwhtml
frontend inline-source layout minifier module sass scaffolding sprite template
Last synced: 6 months ago
JSON representation
Small front-end engineering modular development scaffolding
- Host: GitHub
- URL: https://github.com/chowa/cwhtml
- Owner: chowa
- License: mit
- Created: 2020-02-02T10:00:33.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-07T04:44:46.000Z (almost 6 years ago)
- Last Synced: 2025-07-23T12:59:57.904Z (7 months ago)
- Topics: frontend, inline-source, layout, minifier, module, sass, scaffolding, sprite, template
- Language: TypeScript
- Homepage:
- Size: 56.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# cwhtml
Small front-end engineering modular development scaffolding
[](https://travis-ci.org/chowa/cwhtml)
[](https://www.npmjs.com/package/cwhtml)
[](https://www.npmjs.com/package/cwhtml)
[](https://opensource.org/licenses/MIT)
## Install
```
npm i cwhtml -g
```
## Usage
### create project
```
cwhtml create
```
### build
```
cwhtml build
```
### development
```
cwhtml dev
```
## Congifure
### File
`.cwhtmlrc`
### Options
## Directory rules
```
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
```
## Synatx
### Template inheritance
```
{{extend './layout.tpl'}}
```
### Sub template
***auto include `src/component/header/*`***
```
{{include header}}
```
### Block inheritance
```
{{block content}}
sub conetnt
{{/block}}
```
### Loop
Key and item are keywords
```
{{each from=data}}
{{/each}}
```
### Condition
> does not support boolean
```
{{if a=1}}
true
#{{else}}
false
{{/if}}
{{if c=case}}
case
{{elseif c=which}}
which
{{/if}}
```
### Variable
```
{{set a=1}}
{{a}}
```
### Import style
> support css sass less
```
{{style '../style/index.scss'}}
````
### Import javascript
```
{{script '../js/index.js'}}
````
## Options
```js
root: './src',
output: './dist'
extname: '.tpl'
```