Skip to content

Instantly share code, notes, and snippets.

@jabranr
Last active August 29, 2015 14:01
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 jabranr/1299aefa33d27e900d35 to your computer and use it in GitHub Desktop.
Save jabranr/1299aefa33d27e900d35 to your computer and use it in GitHub Desktop.
Gruntfile boilerplate for JavaScript/Coffee projects
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
coffee: {
options: {
bare: true
},
glob_to_multiple: {
expand: true,
flatten: true,
cwd: "dev/coffee",
src: ["*.coffee"],
dest: "dev/js",
ext: ".js"
}
},
concat: {
options: {
banner: "/*! <%= pkg.name %> | <%= pkg.version %> | <%= pkg.author %> | <%= pkg.license %> | <%= pkg.repo %> */"
},
dist: {
src: ["dev/js/default.js", "dev/js/*.js"],
dest: "src/js-boilerplate.js"
}
},
uglify: {
build: {
src: "src/js-boilerplate.js",
dest: "src/js-boilerplate.min.js"
},
options: {
preserveComments: "some"
}
},
watch: {
scripts: {
files: ["dev/coffee/*.coffee", "dev/js/*.js"],
tasks: ["coffee", "concat", "uglify"],
options: {
spawn: false
}
}
}
});
grunt.loadNpmTasks("grunt-contrib-coffee");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.registerTask("default", ["coffee", "concat", "uglify", "watch"]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment