Skip to content

Instantly share code, notes, and snippets.

@tojibon
Last active September 12, 2015 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tojibon/5087abd538f43ca9c4cc to your computer and use it in GitHub Desktop.
Save tojibon/5087abd538f43ca9c4cc to your computer and use it in GitHub Desktop.
Grunt JS Minify Example
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 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');
};
{
"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