Created
August 23, 2013 01:41
-
-
Save pedronauck/6314705 to your computer and use it in GitHub Desktop.
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) { | |
var config = {}; | |
// Set all the tasks you want to load. | |
var tasks = [ | |
, "grunt-contrib-concat" | |
, "grunt-contrib-uglify" | |
, "grunt-contrib-jshint" | |
, "grunt-contrib-watch" | |
]; | |
// Minify JavaScript. | |
config.uglify = {}; | |
config.uglify.dist = { | |
options: {report: "gzip"} | |
, files: { | |
"pin.min.js": "pin.js" | |
} | |
}; | |
// Concatenate files. | |
config.concat = {}; | |
config.concat.dev = { | |
files: { | |
"pin.js": [ | |
"pin/vendor/emitter.js" | |
, "pin/vendor/module.js" | |
, "pin/model.js" | |
, "pin/helpers.js" | |
, "pin/view.js" | |
] | |
} | |
}; | |
// Set up jshint. | |
config.jshint = {}; | |
config.jshint.dist = { | |
options: {jshintrc: ".jshintrc"} | |
, files: { | |
all: ["pin/*.js"] | |
} | |
}; | |
config.jshint.dev = { | |
options: {jshintrc: ".jshintrc.dev"} | |
, files: { | |
all: ["pin/*.js"] | |
} | |
}; | |
// Set up the watch rules. | |
config.watch = {}; | |
config.watch.scripts = { | |
files: ["pin/**/*.{css,scss,js,hbs}"] | |
, tasks: ["dev"] | |
}; | |
// Register the development task. | |
grunt.registerTask("dev", ["jshint:dev", "concat:dev"]); | |
// Register the production task. | |
grunt.registerTask("build", ["jshint:dist", "concat:dev", "uglify"]); | |
// Initialize Grunt and load all tasks. | |
grunt.initConfig(config); | |
tasks.forEach(grunt.loadNpmTasks); | |
// Set default task. | |
grunt.registerTask("default", ["dev"]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment