A simple, one step, Grunt task for Google Closure Compiler
This plugin requires Grunt 0.4.0
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-simple-closure-compiler --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-simple-closure-compiler');
In your project's Gruntfile, add a section named closure
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
closure: {
options: {
js: 'path/to/input.js',
jsOutputFile: 'path/to/output.js',
compilationLevel: 'SIMPLE_OPTIMIZATIONS'
}
},
})
Type: String
or Array
Required
The path to the input file (or files) that will be compiled.
Type: String
Required
The path to the output file.
Type: String
Default value: SIMPLE_OPTIMIZATIONS
The compilation level that should be used when compiling .js files. Applicable values are:
- 'SIMPLE_OPTIMIZATIONS'
- 'ADVANCED_OPTIMIZATIONS'
- 'WHITESPACE_ONLY'
In this example, the file foo.js will be compiled and output to foo.min.js using simple optimization.
grunt.initConfig({
grunt-simple-closure-compiler: {
options: {
js: 'foo.js',
jsOutputFile: 'foo.min.js'
}
},
})
Latest version of closure compiler added 2013/10/23.