Last active
September 12, 2015 19:41
-
-
Save tojibon/5087abd538f43ca9c4cc to your computer and use it in GitHub Desktop.
Grunt JS Minify Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt){ | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
uglify: { | |
options: { | |
manage: false | |
}, | |
my_target: { | |
files: [{ | |
expand: true, | |
cwd: 'js/', | |
src: ['**/*.js', '!*.min.js'], | |
dest: 'js/', | |
ext:'.min.js' | |
}], | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is to show an example only of a gruntfile.js code to minify and combile multiple JS in a single .js file. | |
*/ | |
module.exports = function(grunt){ | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
uglify: { | |
options: { | |
manage: false | |
}, | |
my_target: { | |
files: { | |
'js/main.min.js': ['js/index1.js', 'js/index2.js'] | |
}, | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "grunt", | |
"version": "1.0.0", | |
"devDependencies": { | |
"grunt-contrib-uglify": "^0.9.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment