gruntjs - How to set the environment for Grunt? -
i defined task section of gruntfile.js
2 environments -- development
, production
. don't understand, how grunt decides, wheter use environment section.
gruntfile.js
module.exports = function(grunt) { // project configuration. grunt.initconfig({ pkg: grunt.file.readjson('package.json'), less: { development: { options: { paths: ["public/css"] }, files: { "public/css/style.css": "public/css/style.less" } }, production: { options: { paths: ["public/css"], plugins: [ ], modifyvars: { } }, files: { "public/css/style.css": "public/css/style.less" } } }, watch: { css: { files: 'public/css/*.less', tasks: ['less'], options: { livereload: true, }, }, } }); // load plugin provides "less" task. grunt.loadnpmtasks('grunt-contrib-less'); // load plugin provides "watch" task. grunt.loadnpmtasks('grunt-contrib-watch'); // default task(s). grunt.registertask('default', ['less', 'watch']); };
how let grunt know, environment active?
to alternate suggest create development
task , run grunt development
// default task(s). grunt.registertask('default', ['less:production', 'watch']); // development task grunt.registertask('development', ['less:development', 'watch']);
Comments
Post a Comment