Skip to main content
  1. Just specify the same path in src and dest.

  2. Yes you can. See Building the files object dynamicallyBuilding the files object dynamically

Example copied from the docs:

grunt.initConfig({ minify: { dynamic_mappings: { // Grunt will search for "**/*.js" under "lib/" when the "minify" task // runs and build the appropriate src-dest file mappings then, so you // don't need to update the Gruntfile when files are added or removed. files: [ { expand: true, // Enable dynamic expansion. cwd: 'lib/' // Src matches are relative to this path. src: ['**/*.js'], // Actual pattern(s) to match. dest: 'build/', // Destination path prefix. ext: '.min.js', // Dest filepaths will have this extension. }, ], }, }, }); 

This pertains to Grunt 0.4

  1. Just specify the same path in src and dest.

  2. Yes you can. See Building the files object dynamically

Example copied from the docs:

grunt.initConfig({ minify: { dynamic_mappings: { // Grunt will search for "**/*.js" under "lib/" when the "minify" task // runs and build the appropriate src-dest file mappings then, so you // don't need to update the Gruntfile when files are added or removed. files: [ { expand: true, // Enable dynamic expansion. cwd: 'lib/' // Src matches are relative to this path. src: ['**/*.js'], // Actual pattern(s) to match. dest: 'build/', // Destination path prefix. ext: '.min.js', // Dest filepaths will have this extension. }, ], }, }, }); 

This pertains to Grunt 0.4

  1. Just specify the same path in src and dest.

  2. Yes you can. See Building the files object dynamically

Example copied from the docs:

grunt.initConfig({ minify: { dynamic_mappings: { // Grunt will search for "**/*.js" under "lib/" when the "minify" task // runs and build the appropriate src-dest file mappings then, so you // don't need to update the Gruntfile when files are added or removed. files: [ { expand: true, // Enable dynamic expansion. cwd: 'lib/' // Src matches are relative to this path. src: ['**/*.js'], // Actual pattern(s) to match. dest: 'build/', // Destination path prefix. ext: '.min.js', // Dest filepaths will have this extension. }, ], }, }, }); 

This pertains to Grunt 0.4

edited body
Source Link
Sindre Sorhus
  • 63.6k
  • 40
  • 176
  • 236
  1. Just specify the same path in src and dest.

  2. Yes you can. See Building the files object dynamically

Example copied from the docs:

grunt.initConfig({ minify: { dynamic_mappings: { // Grunt will search for "**/?*.js" under "lib/" when the "minify" task // runs and build the appropriate src-dest file mappings then, so you // don't need to update the Gruntfile when files are added or removed. files: [ { expand: true, // Enable dynamic expansion. cwd: 'lib/' // Src matches are relative to this path. src: ['**/?*.js'], // Actual pattern(s) to match. dest: 'build/', // Destination path prefix. ext: '.min.js', // Dest filepaths will have this extension. }, ], }, }, }); 

This pertains to almost released Grunt 0.4

  1. Just specify the same path in src and dest.

  2. Yes you can. See Building the files object dynamically

Example copied from the docs:

grunt.initConfig({ minify: { dynamic_mappings: { // Grunt will search for "**/?.js" under "lib/" when the "minify" task // runs and build the appropriate src-dest file mappings then, so you // don't need to update the Gruntfile when files are added or removed. files: [ { expand: true, // Enable dynamic expansion. cwd: 'lib/' // Src matches are relative to this path. src: ['**/?.js'], // Actual pattern(s) to match. dest: 'build/', // Destination path prefix. ext: '.min.js', // Dest filepaths will have this extension. }, ], }, }, }); 

This pertains to almost released Grunt 0.4

  1. Just specify the same path in src and dest.

  2. Yes you can. See Building the files object dynamically

Example copied from the docs:

grunt.initConfig({ minify: { dynamic_mappings: { // Grunt will search for "**/*.js" under "lib/" when the "minify" task // runs and build the appropriate src-dest file mappings then, so you // don't need to update the Gruntfile when files are added or removed. files: [ { expand: true, // Enable dynamic expansion. cwd: 'lib/' // Src matches are relative to this path. src: ['**/*.js'], // Actual pattern(s) to match. dest: 'build/', // Destination path prefix. ext: '.min.js', // Dest filepaths will have this extension. }, ], }, }, }); 

This pertains to Grunt 0.4

Source Link
Sindre Sorhus
  • 63.6k
  • 40
  • 176
  • 236

  1. Just specify the same path in src and dest.

  2. Yes you can. See Building the files object dynamically

Example copied from the docs:

grunt.initConfig({ minify: { dynamic_mappings: { // Grunt will search for "**/?.js" under "lib/" when the "minify" task // runs and build the appropriate src-dest file mappings then, so you // don't need to update the Gruntfile when files are added or removed. files: [ { expand: true, // Enable dynamic expansion. cwd: 'lib/' // Src matches are relative to this path. src: ['**/?.js'], // Actual pattern(s) to match. dest: 'build/', // Destination path prefix. ext: '.min.js', // Dest filepaths will have this extension. }, ], }, }, }); 

This pertains to almost released Grunt 0.4