Skip to content

Instantly share code, notes, and snippets.

@pedronauck
Created August 23, 2013 01: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 pedronauck/6314705 to your computer and use it in GitHub Desktop.
Save pedronauck/6314705 to your computer and use it in GitHub Desktop.
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