Created
December 16, 2013 09:15
-
-
Save frozonfreak/7984296 to your computer and use it in GitHub Desktop.
Grunt File for NodeJS Express Config
This file contains hidden or 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) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
autoprefixer: { | |
options: { | |
browsers: ['last 2 version'] | |
}, | |
multiple_files: { | |
expand: true, | |
flatten: true, | |
src: 'css/build/*.css', | |
dest: 'css/build/prefixed/' | |
} | |
}, | |
cssmin: { | |
combine: { | |
files: { | |
'css/build/minified/global.css': ['css/build/prefixed/global.css'] | |
} | |
} | |
}, | |
jshint: { | |
beforeconcat: ['js/*.js'] | |
}, | |
concat: { | |
dist: { | |
src: [ | |
'public/scripts/vendor/*.js', | |
'public/scripts/global.js' | |
], | |
dest: 'public/scripts/build/production.js' | |
} | |
}, | |
uglify: { | |
build: { | |
src: 'public/scripts/build/production.js', | |
dest: 'public/scripts/build/production.min.js' | |
} | |
}, | |
imagemin: { | |
dynamic: { | |
files: [{ | |
expand: true, | |
cwd: 'public/images/', | |
src: ['**/*.{png,jpg,gif}'], | |
dest: 'public/images/' | |
}] | |
} | |
}, | |
watch: { | |
options: { | |
livereload: true, | |
}, | |
scripts: { | |
files: ['public/scripts/*.js'], | |
tasks: ['concat', 'uglify', 'jshint'], | |
options: { | |
spawn: false, | |
} | |
}, | |
css: { | |
files: ['public/css/*.scss'], | |
tasks: ['sass', 'autoprefixer', 'cssmin'], | |
options: { | |
spawn: false, | |
} | |
}, | |
images: { | |
files: ['public/images/**/*.{png,jpg,gif}', 'public/images/*.{png,jpg,gif}'], | |
tasks: ['imagemin'], | |
options: { | |
spawn: false, | |
} | |
} | |
}, | |
connect: { | |
server: { | |
options: { | |
port: 8000, | |
base: './' | |
} | |
} | |
}, | |
}); | |
require('load-grunt-tasks')(grunt); | |
// Default Task is basically a rebuild | |
grunt.registerTask('default', ['concat', 'uglify', 'imagemin']); | |
grunt.registerTask('dev', ['connect', 'watch']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment