Skip to content

Instantly share code, notes, and snippets.

@fatso83
Created June 26, 2014 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatso83/73875acd1fa3662ef360 to your computer and use it in GitHub Desktop.
Save fatso83/73875acd1fa3662ef360 to your computer and use it in GitHub Desktop.
Grunt file that shows how dynamic config (and option!) values are not used in the grunt-contrib-concat task, but picked up by other tasks
my first file - used for concatenating
my second file - used for concatenating
// Grunt file that shows how dynamic config (and option!) values
// are not used in the grunt-contrib-concat task. Run using 'grunt'
module.exports = function(grunt){
grunt.initConfig({
concat : {
foo : {
src: '<%= grunt.config.get("myfiles") %>',
dest : 'outfile.txt'
}
},
myTask : {
bar : '<%= grunt.config.get("myfiles") %>'
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerMultiTask('myTask', function() {
grunt.log.writeln('myTask:' + this.target + ' data=' + this.data);
});
grunt.registerTask('default', ['myTask','concat']);
grunt.config.set('myfiles',['file1.txt', 'file2.txt'])
}
@fatso83
Copy link
Author

fatso83 commented Jun 26, 2014

The values set by grunt.config.set() are available for use, but seem not to be picked up by the concat task for some reason. You can see them being output by the myTask task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment