node.js - change `dest` option on the fly -
i have grunt tasks compile files , "recycle" them inside different tasks.
i trying modify destination directory without success... idea like:
grunt.registertask('bower', ['compile:index', 'compile:core'], function(){ this.options({dest: 'dist/*.js'}); });
the compile:index
task runs (i.e. when called alone) , has dest: 'index.js
, other tasks have other filenames. change these inside bower
task, adding new directory keeping filename defined in original task.
is possible?
you can create dynamic alias task configures , runs tasks such:
grunt.registertask('bower', function(target) { target = target || 'index'; if (target === 'core') { grunt.config('compile.core.dest', 'dist/core.js'); } else { grunt.config('compile.index.dest', 'dist/index.js'); // call after compile:index has ran configure compile:core grunt.task.run(['compile:index', 'bower:core', 'compile:core']); } });
then entering grunt bower
or grunt bower:index
dynamically configure/run compile:index
task, configure/run compile:core
task.
Comments
Post a Comment