Skip to content

Instantly share code, notes, and snippets.

@grampelberg
Created February 8, 2013 22:29
Show Gist options
  • Save grampelberg/4742477 to your computer and use it in GitHub Desktop.
Save grampelberg/4742477 to your computer and use it in GitHub Desktop.
/*global module:false*/
"use strict";
var _ = require('underscore');
module.exports = function(grunt) {
_.each([
'grunt-contrib-watch',
'grunt-simple-mocha',
'grunt-contrib-less',
'grunt-jade',
'grunt-coffeelint',
'grunt-contrib-jshint',
'grunt-contrib-concat',
'grunt-contrib-clean',
'grunt-barkeep'
],
function(n) { grunt.loadNpmTasks(n); });
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
build_dir: 'build',
header: grunt.file.read('templates/js/header.hdbs'),
footer: grunt.file.read('templates/js/footer.hdbs')
},
snockets: {
prelim: {
src: [ 'vendor/vendor.js', 'lib/index.js' ],
options: {
concat: {
destExtension: "js",
destDir: "<%= meta.build_dir %>"
}
}
},
app: {
src: [ "build/app.js" ],
options: {
concat: {
destExtension: "js",
destDir: "./",
header: "<%= meta.header %>",
footer: "<%= meta.footer %>"
}
}
}
},
watch: {
files: [
'<%= coffeelint.app %>',
'<%= coffeelint.test %>',
'<%= jshint.all %>',
'<%= jade.core.src %>',
'Gruntfile.js'
],
tasks: 'compile'
},
coffeelint: {
app: [ "lib/**/*.coffee" ],
test: [ "test/**/*.coffee" ]
},
jshint: {
all: [ "Gruntfile.js", "lib/*.js", "test/**/*.js" ],
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
node: true,
jquery: true,
predef: [ 'Backbone', 'spyglass', 'window' ]
}
},
jade: {
core: {
src: [ 'templates/**/*.jade'],
dest: 'build/templates',
options: { runtime: false }
}
},
concat: {
templates: {
src: ['build/templates/**/*.js'],
dest: 'build/templates.js'
},
app: {
src: [ "build/vendor.js", "build/templates.js", "build/index.js" ],
dest: "build/app.js"
}
},
clean: {
build: {
src: [ "build" ]
}
}
});
grunt.registerTask('compile', [
'clean',
'jshint',
'coffeelint',
'jade',
'snockets:prelim',
'concat:templates',
'concat:app',
'snockets:app'
]);
grunt.registerTask('dev', [ 'compile', 'watch' ]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment