{"id":13550053,"url":"https://github.com/documentcloud/closure-compiler","last_synced_at":"2025-05-16T15:05:39.155Z","repository":{"id":56874101,"uuid":"376833","full_name":"documentcloud/closure-compiler","owner":"documentcloud","description":"A Ruby Wrapper for the Google Closure Compiler","archived":false,"fork":false,"pushed_at":"2021-12-25T09:34:19.000Z","size":84866,"stargazers_count":202,"open_issues_count":18,"forks_count":53,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-12T11:58:09.110Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://github.com/documentcloud/closure-compiler","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/documentcloud.png","metadata":{"files":{"readme":"README.textile","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-11-18T05:11:23.000Z","updated_at":"2025-03-26T07:45:22.000Z","dependencies_parsed_at":"2022-08-20T22:30:27.763Z","dependency_job_id":null,"html_url":"https://github.com/documentcloud/closure-compiler","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/documentcloud%2Fclosure-compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/documentcloud%2Fclosure-compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/documentcloud%2Fclosure-compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/documentcloud%2Fclosure-compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/documentcloud","download_url":"https://codeload.github.com/documentcloud/closure-compiler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254505132,"owners_count":22082143,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T12:01:28.460Z","updated_at":"2025-05-16T15:05:39.122Z","avatar_url":"https://github.com/documentcloud.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"h1. The Closure Compiler (as a Ruby Gem)\n\nThe *closure-compiler* gem is a svelte wrapper around the \"Google Closure Compiler\":https://developers.google.com/closure/compiler/ for JavaScript compression.\n\nLatest Version: *\"1.1.14\":https://rubygems.org/gems/closure-compiler*\n\nThe Closure Compiler's *2018-05-06* JAR-file is included with the gem.\n\nh2. Installation\n\n\u003cpre\u003e\nsudo gem install closure-compiler\n\u003c/pre\u003e\n\nh2. Usage\n\nThe @Closure::Compiler@ has a @compile@ method, which can be passed a string or an open @IO@ object, and returns the compiled JavaScript. The result is returned as a string, or, if a block is passed, yields as an @IO@ object for streaming writes.\n\n\u003cpre\u003e\nrequire 'rubygems'\nrequire 'closure-compiler'\nClosure::Compiler.new.compile(File.open('underscore.js', 'r'))\n\n=\u003e \"(function(){var j=this,m=j._;function i(a){......\n\u003c/pre\u003e\n\nThe @Closure::Compiler@ also has @compile_file@ and @compile_files@ methods, which can be passed a file path or an array of file paths respectively. The files are concatenated and compiled and, like the @compile@ method, the result is returned as a string or, if block is passed, yields an @IO@ object.\n\n\u003cpre\u003e\nrequire 'rubygems'\nrequire 'closure-compiler'\nClosure::Compiler.new.compile_files(['underscore.js', 'jasmine.js']))\n\n=\u003e \"(function(){var j=this,m=j._;function i(a){......\n\u003c/pre\u003e\n\nWhen creating a @Closure::Compiler@, you can pass \"any options that the command-line compiler accepts\":https://developers.google.com/closure/compiler/docs/gettingstarted_app to the initializer and they'll be forwarded. For example, to raise the compilation level up a notch:\n\n\u003cpre\u003e\nclosure = Closure::Compiler.new(:compilation_level =\u003e 'ADVANCED_OPTIMIZATIONS')\nclosure.compile(File.open('underscore.js', 'r'))\n\n=\u003e \"(function(){var j=this,m=j.h;function i(a){......\n\u003c/pre\u003e\n\nThe default values of all the compiler flags are identical to the command-line version. The default *compilation_level* is \"SIMPLE_OPTIMIZATIONS\".\n\nA @Closure::Error@ exception will be raised, explaining the JavaScript syntax error, if compilation fails for any reason.\n\nh2. YUI Compressor Compatibility\n\nEffort has been made to make the \"closure-compiler\" gem a drop-in alternative to the \"ruby-yui-compressor\". To that end, @Closure::Compiler#compile@ has been aliased as @compress@, and can take the same string or IO argument that a @YUI::JavaScriptCompressor#compress@ can. In addition, the @Closure::Compiler@ initializer can take @java@ and @jar_file@ options, overriding the location of the Java command and the Closure Compiler JAR file, respectively.\n\n\u003cpre\u003e\ncompiler = Closure::Compiler.new(\n  :java     =\u003e '/usr/local/bin/java16',\n  :jar_file =\u003e '/usr/src/closure/build/latest.jar'\n)\n\u003c/pre\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocumentcloud%2Fclosure-compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdocumentcloud%2Fclosure-compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocumentcloud%2Fclosure-compiler/lists"}