Skip to content

Instantly share code, notes, and snippets.

@danielhusar
Last active December 22, 2015 15:49
Show Gist options
  • Save danielhusar/6494926 to your computer and use it in GitHub Desktop.
Save danielhusar/6494926 to your computer and use it in GitHub Desktop.
Default grunt tasks without tests
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
//concat files
concat: {
app : {
src: ['js/*.js', '!js/*min.js'],
dest: 'js/all.js'
}
},
//uglify files
uglify: {
dist: {
src: 'js/*.js', // source files mask
dest: 'js/', // destination folder
expand: true, // allow dynamic building
flatten: true, // remove all unnecessary nesting
ext: '.min.js' // replace .js to .min.js
}
},
//lint
jshint: {
files: ['<%= concat.app.src %>']
},
//watch files
watch: {
files: ['sass/*.scss', 'sass/**/*.scss', 'sass/**/**/.scss'],
tasks: ['c']
},
//compass for compiling sass
compass: {
dist: {
options: {
config: 'config.rb'
}
}
}
});
//Dependencies
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
//Tasks
grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'compass']);
grunt.registerTask('h', ['jshint']);
grunt.registerTask('c', ['concat']);
grunt.registerTask('u', ['uglify']);
grunt.registerTask('c', ['compass']);
grunt.registerTask('w', ['watch']);
return grunt;
};
{
"devDependencies":{
"grunt" : "~0.4.0",
"grunt-contrib-jshint" : "*",
"grunt-contrib-uglify" : "*",
"grunt-contrib-concat" : "*",
"grunt-contrib-watch" : "*",
"grunt-contrib-compass" : "*"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment