{"id":25662,"library":"grunt-closure-compiler","title":"grunt-closure-compiler","description":"A Grunt task for Google Closure Compiler, a JavaScript minifier and optimizer. The latest version is 0.0.21, but the package appears to be stale with no recent updates. It wraps the Closure Compiler JAR file, requiring manual download of the compiler. Compared to alternative Grunt plugins like grunt-contrib-uglify, this offers access to Closure Compiler's advanced optimizations. Users must handle Java dependency, set up environment variables, and manage report files. The package is limited in features and lacks modern ES module support.","status":"maintenance","version":"0.0.21","language":"javascript","source_language":"en","source_url":"git://github.com/gmarty/grunt-closure-compiler","tags":["javascript","Closure Compiler","Minification","Performance","gruntplugin"],"install":[{"cmd":"npm install grunt-closure-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add grunt-closure-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add grunt-closure-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: this plugin requires Grunt to run","package":"grunt","optional":false}],"imports":[{"note":"This is a Grunt plugin, not a module. Use grunt.loadNpmTasks in Gruntfile","wrong":"require('grunt-closure-compiler');","symbol":"closure-compiler task","correct":"grunt.loadNpmTasks('grunt-closure-compiler');"},{"note":"The task name must be 'closure-compiler' (with hyphen) in initConfig","wrong":"grunt.initConfig({ closureCompiler: { ... } });","symbol":"Task configuration","correct":"grunt.initConfig({ 'closure-compiler': { ... } });"},{"note":"Point to the directory containing the JAR, not the JAR itself","wrong":"closurePath: '/path/to/closure-compiler/compiler.jar'","symbol":"Closure Path","correct":"closurePath: '/path/to/closure-compiler'"}],"quickstart":{"code":"// Gruntfile.js\nmodule.exports = function(grunt) {\n  grunt.initConfig({\n    'closure-compiler': {\n      frontend: {\n        closurePath: process.env.CLOSURE_PATH || '/path/to/closure-compiler',\n        js: 'src/input.js',\n        jsOutputFile: 'build/output.min.js',\n        maxBuffer: 500,\n        options: {\n          compilation_level: 'ADVANCED_OPTIMIZATIONS'\n        }\n      }\n    }\n  });\n  grunt.loadNpmTasks('grunt-closure-compiler');\n  grunt.registerTask('default', ['closure-compiler']);\n};","lang":"javascript","description":"Configures a Grunt task using grunt-closure-compiler to minify a JS file with Closure Compiler. Requires manual download of compiler.jar."},"warnings":[{"fix":"Install Java (JRE) and ensure 'java' is in PATH","message":"Requires Java Runtime to be installed and accessible","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Download compiler.jar from https://dl.google.com/closure-compiler/compiler-latest.zip and set 'closurePath' or CLOSURE_PATH environment variable","message":"Closure Compiler JAR must be manually downloaded; no npm dependency","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Use grunt-contrib-uglify or grunt-closure-compiler v0.0.21 with Grunt 0.4, or migrate to modern bundlers","message":"Grunt 0.4+ compatibility issues; not updated for Grunt 1.x","severity":"deprecated","affected_versions":">=0.0.1"},{"fix":"Set maxBuffer to desired size in KB (e.g., 500 for 500KB)","message":"maxBuffer property uses kilobytes, not bytes","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Ensure jsOutputFile path does not accidentally overwrite important files","message":"Output file is overwritten without warning if it exists","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Set 'maxBuffer' property in task config to a larger value in KB (e.g., 500)","cause":"Closure Compiler output exceeds default buffer size (~200KB)","error":"maxBuffer exceeded"},{"fix":"Install Java (JRE) and ensure 'java' command is available","cause":"Java Runtime is not installed or not in PATH","error":"FATAL ERROR: JAVA not found"},{"fix":"Set 'closurePath' to the directory containing compiler.jar, not the JAR itself","cause":"closurePath is pointing to the JAR file instead of its directory, or the JAR is missing","error":"Error: Could not find or load main class com.google.javascript.jscomp.CommandLineRunner"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}