Skip to content

Instantly share code, notes, and snippets.

@jesusr
Created January 13, 2015 10:44
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 jesusr/cf4fd22a1f96303b6c60 to your computer and use it in GitHub Desktop.
Save jesusr/cf4fd22a1f96303b6c60 to your computer and use it in GitHub Desktop.
Gruntfile.js Example
module.exports = function(grunt){
grunt.initConfig({
shell: {
'options': {
'stdout': true,
'stderr': true,
'failOnError': true
},
drushall: {
command: 'drush cc all',
},
drushcssjs: {
command: 'drush cc css-js',
}
},
coffee: {
compile: {
files: {
'path/to/result.js': 'path/to/source.coffee',
'path/to/another.js': ['path/to/sources/*.coffee', 'path/to/more/*.coffee']
}
},
compileWithMaps: {
options: {
sourceMap: true
},
files: {
'path/to/result.js': 'path/to/source.coffee',
'path/to/another.js': ['path/to/sources/*.coffee', 'path/to/more/*.coffee']
}
},
glob_to_multiple: {
expand: true,
flatten: true,
cwd: 'path/to',
src: ['*.coffee'],
dest: 'path/to/dest/',
ext: '.js'
}
},
compass: {
dist: {
sassDir: ['sass'],
cssDir: ['css'],
environment: 'production'
},
dev: {
sassDir: ['sass'],
cssDir: ['css'],
environment: 'development'
},
},
watch: {
configFiles: {
files: [ 'Gruntfile.js', 'config/*.js' ],
options: {
reload: true
}
},
css: {
files: ['sass/**/**/**'],
tasks: ['compass:dev','shell:drushcssjs'],
options: {
spawn: false
}
},
js: {
files: ['coffee/**/**/**'],
tasks: ['coffee:compileWithMaps','shell:drushcssjs'],
options: {
spawn: false
}
}
}
});
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('dev', ['compass:dev','coffee:compileWithMaps','watch','shell:drushall']);
grunt.registerTask('prod', ['compass:dist','coffee:compile','shell:drushall']);
grunt.registerTask('default', ['dev']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment