javascript - How to configure grunt-contrib-uglify to minify files while retaining directory structure -
in case have multiple subdirectories under 'js' directory in example gruntfile posted below, , want retain subdirectories under different destination directory, how do it?
for e.g.
module.exports = function (grunt) { grunt.initconfig({ // define source files , destinations uglify: { files: { src: 'js/**/*.js', // source files mask dest: 'minjs/', // destination folder expand: true, // allow dynamic building flatten: true, // remove unnecessary nesting } } }); // load plugins grunt.loadnpmtasks('grunt-contrib-uglify'); // register @ least 1 task grunt.registertask('default', [ 'uglify' ]); };
in case, have shown */.js, if explicitly specify single subdirectory js/xyz/*.js not copying directory structure, instead seems put files within subdirectory under minjs/ folder in example. missing here? please help.
thanks,
paddy
set flatten property false.
there clear explanation on grunt copy github readme
https://github.com/gruntjs/grunt-contrib-copy
excerpt:
$ grunt copy running "copy:main" (copy) task created 1 directories, copied 1 files done, without errors. $ tree -i node_modules . ├── gruntfile.js ├── dest │ └── src │ ├── │ └── subdir └── src ├── └── subdir └── b 5 directories, 4 files flattening filepath output: copy: { main: { expand: true, cwd: 'src/', src: '**', dest: 'dest/', flatten: true, filter: 'isfile', }, }, $ grunt copy running "copy:main" (copy) task copied 2 files done, without errors. $ tree -i node_modules . ├── gruntfile.js ├── dest │ ├── │ └── b └── src ├── └── subdir └── b 3 directories, 5 files
Comments
Post a Comment