Skip to content

Instantly share code, notes, and snippets.

@dmahipus
Last active August 29, 2015 14:05
Show Gist options
  • Save dmahipus/af702a792f4b2bfbf87c to your computer and use it in GitHub Desktop.
Save dmahipus/af702a792f4b2bfbf87c to your computer and use it in GitHub Desktop.
Basic gruntfile with concat and uglify tasks
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), //<---imports the JSON metadata stored in package.json
concat:{
dist: {
src: [
'js/libs/*.js', // Selects all JS in the libs folder
'js/main.js'
],
dest: 'js/build/production.js', //Output file after concatenating js files
}
},
uglify: {
build: {
src: 'js/build/production.js',
dest: 'js/build/production.min.js'
}
}
});
// Load the plugin that provides the "concat" task.
grunt.loadNpmTasks('grunt-contrib-concat');
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
// Default task(s).
grunt.registerTask('default', ['concat', 'uglify']); //<--- adds "concat" and "uglify" to the default task
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment