<% project_name = File.basename(Compass.configuration.project_path) %><% project_js = Compass.configuration.javascripts_dir %><% project_css = Compass.configuration.css_dir %><% project_sass = Compass.configuration.sass_dir %><% project_img = Compass.configuration.images_dir %>'use strict'; module.exports = function (grunt) { grunt.initConfig({ watch: { options: { livereload: 9001 }, css: { files: ['<%= project_sass %>/{,**/}*.scss'], tasks: ['compass:dev'] }, js: { files: [ '<%= project_js %>/{,**/}*.js', '!<%= project_js %>/{,**/}*.js' ], tasks: ['jshint', 'uglify:dev'] } }, compass: { options: { config: 'config.rb', bundleExec: true }, dev: { options: { environment: 'development' } }, dist: { options: { environment: 'production', imagesDir: '<%= project_img %>-min', force: true } } }, jshint: { options: { jshintrc: '.jshintrc' }, all: ['<%= project_js %>/{,**/}*.js'] }, imagemin: { dist: { options: { optimizationLevel: 3 }, files: [{ expand: true, cwd: '<%= project_img %>', src: ['**/*.png', '**/*.jpg'], dest: '<%= project_img %>-min/' }] } }, svgmin: { dist: { files: [{ expand: true, cwd: '<%= project_img %>', src: '**/*.svg', dest: '<%= project_img %>-min' }] } }, uglify: { dev: { options: { mangle: false, compress: false, beautify: true }, files: [{ expand: true, cwd: '<%= project_js %>', src: ['**/*.js', '!**/*.min.js'], dest: '<%= project_js %>', ext: '.min.js' }] }, dist: { options: { mangle: true, compress: true }, files: [{ expand: true, cwd: '<%= project_js %>', src: ['**/*.js', '!**/*.min.js'], dest: '<%= project_js %>', ext: '.min.js' }] } }, parallel: { assets: { grunt: true, tasks: ['compass:dist', 'imagemin', 'svgmin', 'uglify:dist'] } } }); grunt.event.on('watch', function(action, filepath) { grunt.config([ 'compass:dev', 'jshint' ], filepath); }); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-compass'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-imagemin'); grunt.loadNpmTasks('grunt-parallel'); grunt.loadNpmTasks('grunt-svgmin'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.registerTask('build', [ 'parallel:assets', 'jshint' ]); };