Created
December 5, 2013 22:33
-
-
Save samuelhorn/7815240 to your computer and use it in GitHub Desktop.
My gruntfile for new projects
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({ | |
pkg: grunt.file.readJSON('package.json'), | |
// chech our JS | |
jshint: { | |
options: { | |
"bitwise": true, | |
"browser": true, | |
"curly": true, | |
"eqeqeq": true, | |
"eqnull": true, | |
"esnext": true, | |
"immed": true, | |
"jquery": true, | |
"latedef": true, | |
"newcap": true, | |
"noarg": true, | |
"node": true, | |
"strict": false, | |
"trailing": true, | |
"undef": true, | |
"globals": { | |
"jQuery": true, | |
"alert": true | |
} | |
}, | |
all: [ | |
'Gruntfile.js', | |
'../assets/js/custom.js' | |
] | |
}, | |
// concat and minify our JS | |
uglify: { | |
dist: { | |
files: { | |
'../assets/js/scripts.min.js': [ | |
'../assets/js/vendor/modernizr.js', | |
'../assets/js/vendor/jquery.js', | |
'../assets/js/custom.js' | |
] | |
} | |
} | |
}, | |
// compile our SCSS | |
sass: { | |
dev: { | |
options: { | |
style: 'expanded' | |
}, | |
files: { | |
'../style.css': '../assets/scss/style.scss' | |
} | |
} | |
}, | |
// watch for changes | |
watch: { | |
scss: { | |
files: ['../assets/scss/**/*.scss'], | |
tasks: [ | |
'sass:dev', | |
'notify:scss' | |
] | |
}, | |
js: { | |
files: [ | |
'<%= jshint.all %>' | |
], | |
tasks: [ | |
'jshint', | |
'uglify', | |
'notify:js' | |
] | |
}, | |
inject: { | |
files: [ | |
'../style.css' | |
], | |
options: { | |
livereload: true | |
} | |
}, | |
php: { | |
files: ['../**/*.php'], | |
options: { | |
livereload: true | |
} | |
} | |
}, | |
// notify via OSX | |
notify: { | |
scss: { | |
options: { | |
title: 'Grunt, grunt!', | |
message: 'SCSS is all good' | |
} | |
}, | |
js: { | |
options: { | |
title: 'Grunt, grunt!', | |
message: 'JS is all good' | |
} | |
} | |
} | |
}); | |
// Load NPM's via matchdep | |
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); | |
// Development task | |
grunt.registerTask('default', [ | |
'jshint', | |
'uglify', | |
'sass' | |
]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment