Skip to content

Instantly share code, notes, and snippets.

@johnnyhalife
Created November 22, 2012 23:47
Show Gist options
  • Save johnnyhalife/4133349 to your computer and use it in GitHub Desktop.
Save johnnyhalife/4133349 to your computer and use it in GitHub Desktop.
module.exports = function(grunt){
// Google Closure Tools for Grunt
grunt.loadNpmTasks('grunt-closure-tools');
grunt.initConfig({
/** Minification using Uglify.js **/
concat: {
/** External Dependencies **/
external: {
src: ['./static/js/lib/jquery.1.7.1.min.js', './static/js/lib/jquery-ui.1.8.14.min.js', './static/js/lib/iscroll.js', './static/js/lib/browserDetect.js', './static/js/lib/json2.js', './static/js/lib/color.js', './static/js/lib/scrollfix.js', './static/js/lib/querystring-0.9.0-min.js', './static/js/lib/jquery-plugin/jquery.ui.ipad.js', './static/js/lib/jquery-plugin/jquery.tapandhold.js', './static/js/lib/jquery-plugin/transform.js', './static/js/lib/jquery-plugin/jgestures.js', './static/js/lib/jquery-plugin/jquery.qtip-1.0.0-rc3.js', './static/js/lib/px-loader/PxLoader.js', './static/js/lib/px-loader/PxLoaderImage.js', './static/js/lib/jquery-plugin/jquery.imageLoaded.js', './static/js/lib/jquery-plugin/jquery.infinitescroll.min.js', './static/js/lib/shadowbox.js', './static/js/lib/hammer.js', './static/js/lib/zClip.js', './static/js/lib/jquery.hammer.js', './static/js/lib/jquery.mousewheel.js', './static/js/lib/jquery.masonry.js', './static/js/lib/loggly-0.1.0.js', './static/js/lib/sammy.js', './static/js/lib/tag-it.js', './static/js/lib/chosen.jquery-0.9.8.js', './static/js/lib/rangy-core.js', './static/js/lib/chosen.ajaxaddition.jquery.js', './static/js/lib/jquery.titlealert.js', './static/js/lib/filter_input.js', './static/js/lib/scrollbar.js', './static/js/lib/spectrum.js'],
dest: './static/js/compiled/external.js',
}
},
min: {
/** Bundle everything into a single file **/
all: {
src: ['./static/js/compiled/external.js', './static/js/compiled/compiled.js'],
dest: './static/js/compiled/murally.js',
},
},
/** Google Closure Dependencies Writter */
closureDepsWriter: {
deps: {
closureLibraryPath: './static/js/lib/closure-library/',
depswriter: 'path/to/depswriter.py',
output_file: './static/js/appDeps.js',
options: {
root_with_prefix: ['"./static/js/channel ../../../../channel"', '"./static/js/component ../../../../component"', '"./static/js/controller ../../../../controller"', '"./static/js/dom ../../../../dom"', '"./static/js/model ../../../../model"', '"./static/js/serializer ../../../../serializer"', '"./static/js/service ../../../../service"', '"./static/js/template ../../../../template"', '"./static/js/ui ../../../../ui"', '"./static/js/util ../../../../util"', '"./static/js/view ../../../../view"', '"./static/js/vo ../../../../vo"', '"./static/js/main ../../../../main"', '"./static/js/dto ../../../../dto"']
}
}
},
closureBuilder: {
/** Google Closure Compiler */
production: {
closureLibraryPath: './static/js/lib/closure-library/',
inputs: '',
namespaces: 'murally.main',
root: './static/js',
output_file: './static/js/compiled/compiled.js',
output_mode: 'compiled',
compile: true, // boolean
compiler: './static/js/lib/closure-library/closure/bin/build/compiler.jar',
compiler_options: {
compilation_level: 'ADVANCED_OPTIMIZATIONS',
externs: './static/js/externs.js',
formatting: 'PRETTY_PRINT',
js: ['./static/js/appDeps.js', './static/js/lib/closure-library/closure/goog/deps.js'],
jscomp_error: ['accessControls', 'ambiguousFunctionDecl', 'checkTypes', 'checkVars', 'globalThis', 'invalidCasts', 'missingProperties', 'nonStandardJsDocs', 'unknownDefines', 'uselessCode'],
jscomp_warning: 'visibility'
}
}
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment