I must be missing something very simple here. I am trying to write a function that deals with files. The Grunt API docs state that you can [Build the files object dynamic], but for some reason I cannot get this to work. A simplified version of my Gruntfile.js file is as follows:
module.exports = function(grunt) { grunt.initConfig({ proj: { build: { files: [{ expand: true, cwd: 'src', src: ['**/*.js'], dest: 'dist' }] } } }); grunt.registerTask('proj', function(){ var files = grunt.config('proj.build.files'); console.log(files); }); };
I expect the log to map the list of file associations from the src directory to the dist directory. What is actually logged is the proj.build.files object from config, for example:
Running "proj:build" task [ { expand: true, cwd: 'src', src: [ '**/*.js' ], dest: 'dist' } ] Done, without errors.
The API docs only talk about this type of configuration in terms of other tasks. I tried looking at the uglify task to see how file associations are retrieved, but I could not figure it out.
JoshuaPrior Mar 04 '15 at 5:50 2015-03-04 05:50
source share