Template for new front-end projects.
$ ./deploy.sh
Put your deploy tasks to _deploy directory.
See for key "grunt" in package.json
"grunt": {
"styles": [
{
"path": "styles",
"files": { "build.css": "main.less" }
}
],
"scripts": [
{
"path": "scripts",
"buildFile": "build.js",
"notAmdFiles": [ "*require*.js" ],
"amd": true
}
],
"jshint": {
"development": true,
"production": true
},
"sprites": {
"icons": {
"src": [ "icons/*" ],
"css": "styles/src/icons/icons.less",
"sprite": "images/icons_sprite.png"
}
}
}
"amd" flag for AMD style of js-modules (RequireJS)
Build all (styles and scripts) for production:
$ ./grunt
Or:
$ ./grunt production
Development build (styles and scripts):
$ ./grunt build
Or:
$ ./grunt development
Development build (only styles):
$ ./grunt build-less
Development build (only scripts):
$ ./grunt build-js
Generating sprites
$ ./grunt gen-sprites
Cleanup all builded files:
$ ./grunt clean
Cleanup only styles builds:
$ ./grunt clean-less
Cleanup only scripts builds:
$ ./grunt clean-js
Cleanup sprites:
$ ./grunt clean-sprites
Cleanup initialization:
$ ./grunt distclean
Watch for any changes (in styles and in scripts) and rebuilding:
$ ./grunt watcher
Watch for changes in styles only and rebuilding:
$ ./grunt watcher-less
Watch for changes in scripts only and rebuilding:
$ ./grunt watcher-js
Create file preprocess_context.json
in scripts sources directory with context to preprocessing. See for details: https://github.com/jsoverson/grunt-preprocess
- libs
- src
If you need to specific load order, just name your scripts with number prefixes:
- libs/10-jquery.js
- libs/20-jquery.mousewheel.plugin.js
- src/10-main.js
- src/20-header.js
- src/30-forms.js
For AMD style you need only require.js at first:
- libs/10-require.js
- libs/jquery.js
- libs/jquery.mousewheel.plugin.js
- src/main.js
- src/header.js
- src/forms.js
https://github.com/unclechu/grunt-project-templates/issues
Viacheslav Lotsmanov