gruntjs - Pass in param to 'Grunt watch' for directory -
i use grunt less>css, minification, , concatenation of css , js. wondering if it's possible pass in param when type in "grunt watch" directory watch. way can have multiple versions of site running off same gruntfile.
you can use node's process.argv
command line arguments.
the code below can called with: grunt watch --dir myfolder
grunt.registertask('watch', function() { var args = process.argv; var folder = args[args.indexof('--dir') + 1]; console.log('watch folder: ', folder); // "watch folder: myfolder" });
Comments
Post a Comment