javascript - Dynamically update Grunt config fields -


i have few projects in separate directories , want build them in same way. want define project name task (as param). grunt tasks use project path root path. have several subfolders , not want update manually want update project. there chance that?

grunt.initconfig({   paths : {     project : null,     projectstylesheets : '<%= paths.project %>/stylesheets',     // ...   } });     grunt.registertask('server', function(project) {   // -> project = 'some_name'   var paths = grunt.config.get('paths');   paths.project = project;   grunt.config.set('paths', paths);   // -> { project: 'some_name', projectassets: 'stylesheets' } }); 

i thinking using js functions outside config not sure best practice.

try use registermultitask - http://gruntjs.com/api/grunt.task#grunt.task.registermultitask

grunt.initconfig({     projectname1 : {         projectstylesheets: 'path_to_stylesheets1',     },     projectname2 : {         projectstylesheets: 'path_to_stylesheets2',     } })  grunt.registermultitask('server', function() {     var path = grunt.data.projectstylesheets;         //operations stylesheets });  build use  grunt server:projectname1 grunt server:projectname2 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -