Skip to content

Instantly share code, notes, and snippets.

@mikeislearning
Last active December 20, 2015 03:48
Show Gist options
  • Save mikeislearning/6065802 to your computer and use it in GitHub Desktop.
Save mikeislearning/6065802 to your computer and use it in GitHub Desktop.
My gruntfile and package.json so far: - download relevant grunt modules using 'npm install' - run grunt watch to do live reload and sass compiling - change directories to match your own
/*global module:false*/
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
banner:
'/*!\n' +
' * app.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
' * GNU LGPL v3\n' +
' */'
},
jshint: {
options: {
curly: false,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
eqnull: true,
browser: true,
expr: true,
globals: {
head: false,
module: false,
console: false
}
},
files: [ 'Gruntfile.js', '/dev/js/*.js' ]
},
concat: {
options:{
separator: ';'
},
js: {
src: ['dev/js/*.js'],
dest: 'build/js/app.js'
},
css:{
src: ['dev/css/*.css'],
dest: 'build/css/app.css'
}
},
uglify: {
options: {
banner: '<%= meta.banner %>\n'
},
build: {
src: '<%= concat.js.dest %>',
dest: 'build/js/app.min.js'
}
},
cssmin: {
options: {
banner: '/*!\n' +
' * app.min.css <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
' * GNU LGPL v3\n' +
' */'
},
compress: {
files: {
'build/css/app.min.css': [ '<%= concat.css.dest %>' ]
}
}
},
compass: {
dev: {
options: {
config: 'config.rb'
}
}
},
watch: {
meow: {
files: ['dev/sass/*.scss'],
options: {
livereload: true
},
tasks: ['compass']
},
/* watch our files for change, reload */
livereload: {
files: ['*.html', 'dev/js/*.js', '*.php','includes/*.php'],
options: {
livereload: true
}
}
}
});
//require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-concat' );
grunt.loadNpmTasks( 'grunt-contrib-compass');
grunt.loadNpmTasks( 'grunt-contrib-watch');
grunt.loadNpmTasks( 'grunt-concurrent');
// Default task.
grunt.registerTask( 'default', [ 'jshint','cssmin', 'concat', 'uglify','compass', 'watch'] );
};
{
"name": "",
"version": "0.0.1",
"author": "",
"homepage": "",
"devDependencies": {
"grunt": "~0.4.0",
"grunt-contrib-concat": "~0.1.3",
"grunt-contrib-uglify": "~0.1.1",
"grunt-contrib-cssmin": "~0.4.1",
"grunt-contrib-jshint": "~0.1.0",
"grunt-contrib-compress": "~0.3.3",
"grunt-contrib-connect": "~0.3.0",
"grunt-contrib-compass": "~0.3.0",
"grunt-contrib-watch": "~0.4.4",
"grunt-concurrent": "~0.3.0",
"matchdep": "~0.1.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment