Some boilerplate code for static site generation
- Clone this repository
git clone https://github.com/bdadam/static-site-boilerplate
- Install node dependencies
npm install
- Install bower dependencies
bower install
- Simply run
grunt build
to see that everything works
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.
grunt
- default task: build everything and then whatches for changes and regenerated the affected filesgrunt build
- builds everythinggrunt clean
- cleanupgrunt assemble
- generates html with Assemblegrunt less
- generated css file(s) from less filesgrunt sass
- generated css file(s) from scss filesgrunt uncss
- removes unnecessary css rulesgrunt requirejs
- generates JavaScript files with RequireJS (or Almond)grunt webpack
- generates JavaScript files with WebPack - uses CommonJS formatgrunt hashres
- computes hash code for static resources (aka cachebusting)grunt connect
- starts web server and stops it automatically when all the other tasks finishedgrunt watch
- checks for file modifications and runs the appropriate tasksgrunt dev
- runs a complete build and then waits for modifications (watch)
grunt karma:dist
- runs JS unit tests in Chrome, Firefox, IE and PhantomJSgrunt 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.
- Static site generation with Assemble
- Generating and minifying a single CSS file with Less
- Generating and minifying a single JavaScript file with RequireJS or WebPack
- Linting JS files with ESlint
- Unit testing for JavaScript with Karma
- Generating hash (cache buster) for JS and CSS files
- Automatic regeneration and Liverload during development