Created
June 25, 2014 15:52
-
-
Save steve-ross/77509c9e9140ae89d41a to your computer and use it in GitHub Desktop.
grunt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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