static-scaffold v0.5.0
static-scaffold
a scaffold for develop and build static website fast.
Features
- fast bootstrap a static website project
- local preview(no need to config nginx or apache)
- support template engine like
jade,swig - supoort live-reload
- build static files(compile jade or swig templates)
- build with both gulp and grunt (in dev)
- fast deploy with ftp or other ways (in plan)
- support less, sass
- still planning...
Install
$ npm i -g static-scaffoldInit Proj
$ scaffold demoUsage
Preview && develop
change to your 'demo' dir
$ cd demoinstall node deps
$ npm istart local server
$ node --harmony app.jsor, when you're developing, you can start a live-reload server:
$ node --harmony gulp livevisit http://localhost:8300
Build
$ gulp buildThis command will build static website into ./dist dir.
Currently in dev now. :)
How it works
First, we defined two mode:
live: which is useful when developing, it will auto reload page if any source file changed.build: which is for building the final static website files.
with the default gulpfile, here are the workflows:
local server:
We use koa and some middlewares to build our http server, so we perfectly don't need nginx or apache.
html:
live: with jade or swig will be rendered instant by koa middlewares. It doesn't write file in live.
build: we use gulp plugins to build html files. It will generate .html files into dist with the same dir structure in src
js:
live: it will be loaded just right in src dir by koa-static.
build: we just copy .js files from src to dist(may be changed in the future)
css:
live: less, sass files will be compiled into dist dir, and then servered by koa-static. The vanilla css files will be servered as the other assets files.
build: less, sass files will be compiled into dist/css dir.
others:
others files in src/assets will serverd by koa-static in live , and copied into dist/assets when builc
compress:
everything in dist/css and dist/js will be compressed into a combined js or css files and be renamed with hash to fight with browser's cache.