Last active
August 31, 2015 20:32
-
-
Save wastrachan/2e9769de6a917cb03f19 to your computer and use it in GitHub Desktop.
Coffee & Compass Gruntfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (grunt) -> | |
grunt.initConfig({ | |
# Load package.json | |
pkg: grunt.file.readJSON('package.json') | |
# Compass config | |
compass: | |
dist: | |
options: | |
sassDir: 'static/css/src' | |
cssDir: 'static/css' | |
environment: 'production' | |
outputStyle: 'compressed' | |
noLineComments: true | |
# Coffee-script config | |
coffee: | |
dist: | |
files: | |
'static/js/common.js': ['static/js/src/common.coffee', | |
'static/js/src/pages/*.coffee', | |
'static/js/src/*.coffee'] | |
# Uglify config | |
uglify: | |
dist: | |
options: | |
mangle: true | |
files: | |
'static/js/common.min.js': ['static/js/common.js'] | |
# Watch source files and compile | |
watch: | |
compass: | |
files: ['static/css/src/**/*.sass'] | |
tasks: ['compass:dist'] | |
coffee: | |
files: ['static/js/src/**/*.coffee'] | |
tasks: ['coffee:dist', 'uglify:dist'] | |
# Run watch tasks concurrently | |
concurrent: | |
assets: | |
tasks: ['watch:compass', 'watch:coffee'] | |
options: | |
logConcurrentOutput: true | |
}) | |
# Load tasks from NPM modules | |
grunt.loadNpmTasks('grunt-concurrent') | |
grunt.loadNpmTasks('grunt-contrib-watch') | |
grunt.loadNpmTasks('grunt-contrib-compass') | |
grunt.loadNpmTasks('grunt-contrib-coffee') | |
grunt.loadNpmTasks('grunt-contrib-uglify') | |
# Register tasks to run | |
grunt.registerTask('css', 'Watch sass and compile', ['watch:compass']) | |
grunt.registerTask('js', 'Watch coffee-script and compile', ['watch:coffee']) | |
grunt.registerTask('mangle', 'Mangle compiled javascript', ['uglify:dist']) | |
grunt.registerTask('compile', 'Watch sass and coffee-script and compile', ['concurrent:assets']) | |
grunt.registerTask('default', 'Compile sass and coffee-script', ['compass:dist', 'coffee:dist', 'uglify:dist']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment