Some boilerplate code for static site generation
How to use this?
- Clone this repository
git clone https://github.com/bdadam/static-site-boilerplate
- Install node dependencies
- Install bower dependencies
- Simply run
grunt buildto see that everything works
How to work with this?
You can run
grunt dev while developing. This starts a new web server on port 3000 (http://localhost:3000/).
After every change the affected files are regenerated.
Available Grunt tasks
grunt- default task: build everything and then whatches for changes and regenerated the affected files
grunt build- builds everything
grunt clean- cleanup
grunt assemble- generates html with Assemble
grunt less- generated css file(s) from less files
grunt sass- generated css file(s) from scss files
grunt uncss- removes unnecessary css rules
grunt hashres- computes hash code for static resources (aka cachebusting)
grunt connect- starts web server and stops it automatically when all the other tasks finished
grunt watch- checks for file modifications and runs the appropriate tasks
grunt dev- runs a complete build and then waits for modifications (watch)
grunt karma:dist- runs JS unit tests in Chrome, Firefox, IE and PhantomJS
grunt karma:dev- runs JS unit tests in PhantomJS only
All tasks accept a
--dev flag, which disables many optimizations (minification), enables source maps, etc. This should only be used during development.
What is included?
- Static site generation with Assemble
- Generating and minifying a single CSS file with Less
- Linting JS files with ESlint
- Generating hash (cache buster) for JS and CSS files
- Automatic regeneration and Liverload during development