Skip to content

Instantly share code, notes, and snippets.

@samuelhorn
Created December 5, 2013 22:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samuelhorn/7815240 to your computer and use it in GitHub Desktop.
Save samuelhorn/7815240 to your computer and use it in GitHub Desktop.
My gruntfile for new projects
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