Skip to content

Instantly share code, notes, and snippets.

@steve-ross
Created June 25, 2014 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steve-ross/77509c9e9140ae89d41a to your computer and use it in GitHub Desktop.
Save steve-ross/77509c9e9140ae89d41a to your computer and use it in GitHub Desktop.
grunt
module.exports = function(grunt) {
var target = grunt.option('target') || 'dev';
var watch_tasks = ['concat:js'];
if(target != 'dev') watch_tasks.push('uglify:js');
grunt.registerTask('watch', [ 'watch' ]);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
js: {
options: {
},
src: [
'app/*.js',
'app/**/*.js'
],
dest: 'app.min.js'
},
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n',
mangle: false
},
js: {
files: {
'app.min.js': ['app.min.js']
}
}
},
less: {
style: {
files: {
'public/css/style.css': 'less/style.less'
}
}
},
watch: {
html: {
files: ['templates/*.html', '../../../app/views/layouts/ng.html.erb', '../../../app/views/ng/*', '../../../app/assets/stylesheets/ng.css.scss'],
options: {
livereload: true,
}
},
js: {
files: ['*.js'],
tasks: watch_tasks,
options: {
livereload: true,
}
},
css: {
files: ['less/*.less'],
tasks: ['less:style'],
options: {
livereload: true,
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment