Skip to content

Instantly share code, notes, and snippets.

@jonchretien
Created September 23, 2013 19:58
Show Gist options
  • Save jonchretien/6676049 to your computer and use it in GitHub Desktop.
Save jonchretien/6676049 to your computer and use it in GitHub Desktop.
// Install a grunt plugin and save to devDependencies
// ex: gi nodemon
function gi() {
npm install --save-dev grunt-"$@"
}
// Install a grunt-contrib plugin and save to devDependencies
function gci() {
npm install --save-dev grunt-contrib-"$@"
}
// Invest in a good watch
watch: {
scripts: {
files: ['*.js', 'src/**.js'],
tasks: ['jshint:all', 'copy:scripts'],
options: {
livereload: true
}
},
compass: {
files: ['src/styles/**'],
tasks: ['compass:dev'],
options: {
livereload: true
}
},
handlebars: {
files: ['src/templates/**'],
tasks: ['handlebars:dev'],
options: {
livereload: true
}
},
jasmine: {
files: ['test/spec/**'],
tasks: ['jshint:all', 'jasmine:all']
}
}
// Using variables in your configuration
module.exports = function (grunt) {
var globalConfig = {
src: 'src',
dest: 'dev'
};
grunt.initConfig({
globalConfig: globalConfig,
compass: {
options: {
sassDir: '<%= globalConfig.src %>/styles',
cssDir: '<%= globalConfig.dest %>'
},
dev: {}
},
handlebars: {
compile: {
files: [{
src: ['<%= globalConfig.src %>/templates/*.hbs'],
dest: '<%= globalConfig.dest %>/scripts/compiledTemplates/appTemplates.js'
}]
}
},
copy: {
scripts: {
files: [{
expand: true,
cwd: '<%= globalConfig.src %>/scripts',
src: ['**'],
dest: '<%= globalConfig.dest %>/scripts'
}]
}
}
});
grunt.registerTask('build:dev', ['compass:dev', 'handlebars:compile', 'copy:scripts']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment