gruntjs - How to `uglyfy` all files from a folder to dest folder using grunt? -


i have grunt file. @ present have set 1 file src , dest. works well. how set js file folder dest folder?

here config file :

    module.exports = function(grunt) {      grunt.initconfig({           pkg: grunt.file.readjson('package.json'),           uglify: {           options: {             banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n*/\n'           },           build: {             files: {               'dist/js/newmagic.min.js' : 'js/script/helloworld.js' //instead how set dest/js : js/script/alljsfiles?             }           }         }      });       grunt.loadnpmtasks('grunt-contrib-uglify'); //this 1 runs.      grunt.loadnpmtasks('grunt-contrib-watch'); how run both?       }; 

my command: grunt uglify

the frequent use of uglify reduce many input files 1 output file:

uglify: {   options: {     banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n*/\n'   },   build: {     files: [       {         "dist/js/newmagic.min.js": ["js/script/**/*.js"]       }     ]   }, } 

if want uglify many inputs many outputs, can file spec this:

uglify: {   options: {     banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n*/\n'   },   build: {     files: [       {         src: ["**/*.js"],         dest: "dist/js",         cwd: "js/script",         expand: true       }     ]   }, } 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -