Created
July 2, 2012 21:47
-
-
Save joshcarr/3035919 to your computer and use it in GitHub Desktop.
Sample gruntfile
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 SRC_CSS = 'src/css/', | |
SRC_JS = 'src/js/', | |
BUILD_CSS = 'css/', | |
BUILD_JS = 'js/'; | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: '<json:package.json>', | |
meta: { | |
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + | |
'<%= grunt.template.today("yyyy-mm-dd") %>\n' + | |
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + | |
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + | |
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' | |
}, | |
min: { | |
js: { | |
src: '<config:concat.js.dest>', | |
dest: BUILD_JS + 'all.js' | |
} | |
}, | |
cssmin: { | |
css: { | |
src: '<config:concat.css.dest>', | |
dest: BUILD_CSS + 'all.css' | |
} | |
}, | |
lint: { | |
files: [SRC_JS + 'app/**/*.js'] | |
}, | |
watch: { | |
js: { | |
files: '<config:concat.js.src>', | |
tasks: 'concat:js' | |
}, | |
less: { | |
files: '<config:concat.less.src>', | |
tasks: 'concat:less less concat:css' | |
} | |
}, | |
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: { | |
jQuery: true | |
} | |
}, | |
less: { | |
css: { | |
src: SRC_CSS + 'app/base.less', | |
dest: SRC_CSS + 'app/base.css' | |
} | |
}, | |
concat: { | |
less: { | |
src: [SRC_CSS + 'libs/bootstrap.less', | |
SRC_CSS + 'less/styles.less'], | |
dest: SRC_CSS + 'app/base.less', | |
}, | |
css: { | |
src: [SRC_CSS + 'libs/*.css', | |
SRC_CSS + 'app/*.css'], | |
dest: BUILD_CSS + 'all.css' | |
}, | |
js: { | |
src: [SRC_JS + 'libs/jquery-1.7.2.js', | |
SRC_JS + 'libs/jquery.follower.js', | |
SRC_JS + 'libs/jquery.fancybox.js', | |
SRC_JS + 'app/app.js'], | |
dest: BUILD_JS + 'all.js' | |
}, | |
} | |
}); | |
grunt.loadNpmTasks('grunt-less'); | |
grunt.loadNpmTasks('grunt-css'); | |
// Default task. | |
grunt.registerTask('default', 'lint concat:less less concat min cssmin'); | |
grunt.registerTask('hint', 'lint'); | |
grunt.registerTask('minify', 'concat:less less concat min cssmin'); | |
}; |
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
{ | |
"name": "Sitename", | |
"version": "1.0.0", | |
"dependencies" : { | |
"grunt-less": ">0.0.0", | |
"grunt-css": ">0.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment