项目作者: phonglk

项目描述 :
Simple HTML Template
高级语言: JavaScript
项目地址: git://github.com/phonglk/simple-html-template.git
创建时间: 2017-05-26T08:21:23Z
项目社区:https://github.com/phonglk/simple-html-template

开源协议:Apache License 2.0

下载


Introduction

Simple HTML Template Language
We are not trying to create new XML Language but extend the HTML to specific use case

Diagram

API

<include src="<path to html file>" />

Content of the file will replace tag
If there are tabs/spaces before included tag. Every line of ‘content’ will be prefixed by same spaces/tabs

CLI

There are 2 exposed executable

Compile

./node_modules/.bin/sht-cli ./html

Watch and compile

./node_modules/.bin/sht-cli-watch ./html

OR

package.json

  1. {
  2. "scripts": {
  3. "compile-template": "sht-cli ./html",
  4. "watch-template": "sht-cli-watch ./html"
  5. }
  6. }

Using With NPX

npx sht-cli-watch ./html

Configuration

To customise output of the compilation, please place sht.config.json inside the template folder (such as “./html”)

Please take a look at example/html/sht.config.json for example

Default configuration:
{ "outDir": "./compiled", "ignores": [/^partial$/, /^compiled$/, /\.compiled\.html$/], "include": /\.html$/, }

Why I made this

This is simple, just do one job and try to do good: reuse html partials

This especially useful for who do the Slicing PSD to HTML Jobs

After all, there is no abnormal syntax that broke your html file. Just pure HTML with a little bit automation to connect partials together.

Example

node ./lib/cli.js ./example/html/

Test

npm test

TDD

npm run test-dev

Test coverage

npm run coverage