Created
May 7, 2012 20:31
-
-
Save pamelafox/2630204 to your computer and use it in GitHub Desktop.
Grunt for a CSS/JS WebApp
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
/*global module:false*/ | |
module.exports = function(grunt) { | |
var CSS_DIR = 'src/css/'; | |
var JS_DIR = 'src/js/'; | |
var BUILD_DIR = '../build/'; | |
// Project configuration. | |
grunt.initConfig({ | |
lint: { | |
files: [JS_DIR + 'app/**/*.js'] | |
}, | |
less: { | |
css: { | |
src: [CSS_DIR + 'less/base.less'], | |
dest: CSS_DIR + 'base.css', | |
} | |
}, | |
concat: { | |
css: { | |
src: [CSS_DIR + 'libs/*.css', CSS_DIR + 'app/*.css'], | |
dest: BUILD_DIR + 'css/editor.css' | |
}, | |
js: { | |
src: [JS_DIR + 'libs/bootstrap.js', JS_DIR + 'libs/closure-all.js', JS_DIR + 'app/*.js'], | |
dest: BUILD_DIR + 'js/editor.js' | |
}, | |
}, | |
min: { | |
js: { | |
src: '<config:concat.js.dest>', | |
dest: BUILD_DIR + 'js/editor-min.js' | |
} | |
}, | |
cssmin: { | |
css: { | |
src: '<config:concat.css.dest>', | |
dest: BUILD_DIR + 'css/editor-min.css' | |
} | |
}, | |
watch: { | |
files: '<config:lint.files>', | |
tasks: 'lint' | |
}, | |
jshint: { | |
options: { | |
curly: true, | |
eqeqeq: true, | |
immed: true, | |
latedef: true, | |
newcap: true, | |
noarg: true, | |
sub: true, | |
undef: true, | |
boss: true, | |
eqnull: true, | |
browser: true | |
}, | |
globals: {'goog': true} | |
}, | |
uglify: {} | |
}); | |
grunt.loadNpmTasks('/usr/local/lib/node_modules/grunt-less'); | |
grunt.loadNpmTasks('/usr/local/lib/node_modules/grunt-css'); | |
// Default task. | |
grunt.registerTask('default', 'less concat min cssmin'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could install the
grunt-less
andgrunt-css
plugins locally usingnpm install
without the-g
option. Or add them into a project-specific npmpackage.json
file and then just runnpm install
to initialize your project.Then, you could just do this, because they'd be installed locally: