Skip to content

Instantly share code, notes, and snippets.

@xjackk
Last active August 29, 2015 13:57
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 xjackk/9731196 to your computer and use it in GitHub Desktop.
Save xjackk/9731196 to your computer and use it in GitHub Desktop.
Compile Coffee, LESS, Clean and Build your environment.
module.exports = (grunt) ->
grunt.initConfig
coffee:
compile_client:
expand: true,
flatten: false,
cwd: 'src/client',
src: ['**/*.coffee'],
dest: 'build/js',
ext: '.js'
compile_server:
options:
bare: true
expand: true,
flatten: false,
cwd: 'src/server',
src: ['**/*.coffee'],
dest: 'lib/',
ext: '.js'
clean:
bower_components:
src: ['build/bower_components']
js:
src: ['build/js']
css:
src: ['build/css,build/fonts']
copy:
bower_components:
files: [
(expand: true, cwd: 'bower_components/', src: ['**/*'], dest: 'build/bower_components/')
]
mustache_templates:
files: [
(expand: true, cwd: 'src/client/', src: ['**/*.htm'], dest: 'build/js/')
]
bootstrap_fonts:
files:[
(expand:true,cwd:'build/bower_components/bootstrap/dist/',src: ['fonts/*'],dest:'build/')
]
autoprefixer:
build:
expand:true
cwd:'build/css'
src:['**/*.css']
dest: 'build/css'
less:
bootstrap:
files:
"build/css/bootstrap.css": "build/bower_components/bootstrap/less/bootstrap.less"
application:
files:
"build/css/main.css": "src/client/less/main.less"
watch:
less_client:
files: 'src/client/less/**/*.less'
tasks: ['less:application']
coffee_server:
files: 'src/server/**/*.coffee'
tasks: ['coffee:compile_server']
coffee_client:
files: 'src/client/**/*.coffee'
tasks: ['coffee:compile_client']
mustache_client:
files: 'src/client/**/*.htm'
tasks: ['copy']
grunt.loadNpmTasks 'grunt-contrib-less'
grunt.loadNpmTasks 'grunt-contrib-copy'
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-autoprefixer'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.registerTask "default", ['clean', 'copy', 'less', 'autoprefixer', 'coffee', 'watch']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment