generator-fresh
Version:
mad fresh boilerplate generator for yeoman
144 lines (117 loc) • 2.57 kB
JavaScript
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Configure JSHint
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'.tmp/js/app/{,*/}*.js', // compiled coffeescripts
'js/app/{,*/}*.js',
'js/app/app.js'
]
},
// Configure Coffeescript parsing
coffee: {
dist: {
files: [{
expand: true,
cwd: 'js/app',
src: '{,*/}*.coffee',
dest: '.tmp/js/app',
ext: '.js'
}]
}
},
// Configuration for concatinating files
concat: {
dist: {
src: [
'js/vendor/jquery-1.10.2.js',
'js/vendor/polyfills.js',
'.tmp/js/app/components/*.js',
'.tmp/js/app/app.js'
],
dest: '.tmp/js/application.js'
}
},
// Minify the javascript
uglify: {
build: {
src: '.tmp/js/application.js',
dest: 'js/application.min.js'
},
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
}
},
// Process stylesheets with Compass
compass: {
dist: {
options: {
config: 'config/compass.rb'
}
}
},
// Remove temporary files after each build
clean: {
release: ['.tmp']
},
// Setup watcher
watch: {
scripts: {
files: ['js/{,*/}*.js', 'js/app/{,*/}*.coffee'],
tasks: ['coffee', 'jshint', 'concat', 'uglify'],
options: {
spawn: false
}
},
css: {
files: ['styles/sass/**/*.scss'],
tasks: ['compass'],
options: {
spawn: false
}
}
}
});
// Tell grunt to load all tasks with nifty loader
require('load-grunt-tasks')(grunt);
// Build processes
// default helper: process
// $ grunt process
grunt.registerTask('process', [
'coffee',
'compass'
]);
// default helper: test
// $ grunt test
grunt.registerTask('test', [
'process',
'jshint'
]);
// default helper: build
// $ grunt build
grunt.registerTask('build', [
'concat',
'uglify'
]);
// helper method: build-all
// useful for checking unminified files
// $ grunt build-all
grunt.registerTask('build-all', [
'process',
'concat',
'uglify'
]);
// default process
// $ grunt
grunt.registerTask('default', [
'test',
'build',
'clean'
]);
};