Last active
December 17, 2015 18:39
-
-
Save abdulapopoola/5655160 to your computer and use it in GitHub Desktop.
Sample GruntJS config file
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 = function(grunt) { | |
grunt.initConfig({ | |
qunit: { | |
files: ['test/**/*.html'] | |
}, | |
jshint: { //Lint files, different tasks exist | |
tests: { //lint JS tests | |
files: { | |
src: ['test/**/*.js'] | |
}, | |
options: { | |
globals: { | |
jQuery: true, | |
console: true, | |
module: true, | |
document: true | |
} | |
} | |
}, | |
target: { //lint production JS | |
files: { | |
src: ['target/controllers/*.js', | |
'target/models/*.js', | |
'target/routes/*.js', | |
'target/views/*.js', | |
'target/app.js', | |
'target/main.js'] | |
}, | |
options: { | |
globals: { | |
jQuery: true, | |
console: true, | |
module: true, | |
document: true | |
} | |
} | |
} | |
}, | |
watch: { //Watch files for changes | |
scripts: { | |
options: { | |
livereload: true | |
}, | |
files: ['./js/**/*'], | |
tasks: ['jshint'] | |
} | |
}, | |
compass: { //Compile SASS into CSS | |
dist: { | |
options: { | |
config: './public/config.rb', | |
sassDir: './public/css/scss/', | |
cssDir: './public/dump', | |
imagesDir: './public/images', | |
outputStyle: 'compressed', | |
noLineComments: true | |
} | |
}, | |
dev: { | |
options: { | |
config: './public/config.rb', | |
sassDir: './public/css/scss/', | |
cssDir: './public/css' | |
} | |
} | |
}, | |
cssmin: { //minify CSS | |
minify: { | |
files: { | |
'./public/css/prd.min.css': ['./public/css/styles.css'] | |
}, | |
options: { | |
report: 'gzip' | |
} | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.loadNpmTasks('grunt-contrib-qunit'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-concat'); | |
grunt.loadNpmTasks('grunt-sass'); | |
grunt.loadNpmTasks('grunt-contrib-cssmin'); | |
grunt.registerTask('test', ['jshint:js', 'qunit']); | |
grunt.registerTask('prod', ['jshint:js', 'compass:dist', 'cssmin']); | |
grunt.registerTask('default', ['jshint:js', 'compass:dev', 'compass:dist']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment