Skip to content

Instantly share code, notes, and snippets.

@yesdevnull
Created February 5, 2015 01:54
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 yesdevnull/043307a5435231fa0777 to your computer and use it in GitHub Desktop.
Save yesdevnull/043307a5435231fa0777 to your computer and use it in GitHub Desktop.
Getting Started with Grunt article: set up package.json and uglify task.
module.exports = function(grunt) {
// This is where our tasks go
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
preserveComments: 'some'
},
core_dev: {
options: {
mangle: false,
compress: false
},
files: [{
src: 'src/js/core/*.js',
dest: 'dist/js/core.min.js'
}]
},
core_dist: {
options: {
sourceMap: false
},
files: [{
src: 'src/js/core/*.js',
dest: 'dist/js/core.min.js'
}]
},
extras: {
options: {
sourceMap: false
},
files: [{
expand: true,
cwd: 'src/js',
src: '*.js',
dest: 'dist/js',
ext: '.min.js',
extDot: 'first'
}]
}
}
});
// Load tasks from the installed modules
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-focus');
grunt.loadNpmTasks('grunt-notify');
}
{
"name": "my-project-name",
"version": "0.1.0",
"private": true,
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-sass": "^0.8.1",
"grunt-contrib-uglify": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-focus": "^0.1.1",
"grunt-notify": "^0.4.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment