Skip to content

Instantly share code, notes, and snippets.

@vsr
Created November 15, 2013 21:07
Show Gist options
  • Save vsr/7491628 to your computer and use it in GitHub Desktop.
Save vsr/7491628 to your computer and use it in GitHub Desktop.
First, basic Gruntfile.js
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';',
},
js: {
src: ['www/js/a.js', 'www/js/b.js', 'www/js/init.js'],
dest: 'www/js/scripts.js',
},
css: {
src: ['www/css/normalize.css', 'www/css/main.css'],
dest: 'www/css/styles.css',
},
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
dist: {
files: {
'www/js/scripts.min.js': ['<%= concat.js.dest %>']
}
}
},
cssmin: {
css: {
files: {
'www/css/styles.min.css': ['<%= concat.css.src %>']
}
}
},
watch: {
files: ['<%= concat.js.src %>', '<%= concat.css.src %>'],
tasks: ['concat', 'uglify', 'cssmin']
},
jshint: {
files: ['Gruntfile.js', '*.js', '<%= concat.js.src %>'],
options: {
globals: {
console: true,
module: true
}
}
},
nodemon: {
dev: {}
},
concurrent: {
dev: {
tasks: ['nodemon', 'watch'],
options: {
logConcurrentOutput: true
}
}
},
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-concurrent');
grunt.registerTask('build', ['concat', 'uglify', 'cssmin']);
grunt.registerTask('default', ['concurrent']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment