Created
February 5, 2015 01:54
-
-
Save yesdevnull/043307a5435231fa0777 to your computer and use it in GitHub Desktop.
Getting Started with Grunt article: set up package.json and uglify task.
This file contains hidden or 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) { | |
// 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'); | |
} |
This file contains hidden or 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": "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