Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ClosureCompiler filter. #170

Merged
merged 3 commits into from Mar 22, 2014
Merged

Add ClosureCompiler filter. #170

merged 3 commits into from Mar 22, 2014

Conversation

jadb
Copy link
Contributor

@jadb jadb commented Jul 13, 2013

A new filter for those of us who want to use the Google Closure compiler API. Similar to the ClosureJS filter but without having to install JAVA nor the closure/compiler.jar.

The compilation level can be set using the level key in settings like so:

[filter_ClosureCompiler]
level = SIMPLE_OPTIMIZATIONS

One can also check statistics and/or warnings (only in debug mode):

[filter_ClosureCompiler]
statistics = true
warnings = true

Furthermore, extra parameters can be passed to the API like so:

[filter_ClosureCompiler]
level = ADVANCED_OPTIMIZATIONS
formatting = pretty_print
externs_url = http://www.myserver.com/myexterns.js

That's about it!

Hoping it is judged useful to others and gets added to the plugin's core.

Best,

Jad

*/
protected $_settings = array(
'level' => null,
'print' => "%s:\n%s\n",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be configurable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

@jadb
Copy link
Contributor Author

jadb commented Feb 27, 2014

Bumping this to see if there are any chances this will get merged soon so I can use the original repo again?


$$setting = $this->_query($content, $args);
printf("%s:\n%s\n", ucfirst($setting), $$setting);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this printing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the shell command's output. Should I remove it?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not overly familiar with the closure webservice, what purpose does printing this out serve?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closure can return an output:

output_info
The value of this parameter indicates the kind of information that you want from the compiler.
There are four possible kinds of output: compiled_code, warnings, errors, and statistics. This
example uses the value compiled_code, which tells the Closure Compiler service to output the
compressed version of the JavaScript it receives in the request.

In here it's used to output 'warnings' and/or 'statistics'.

@markstory markstory added this to the 0.11 milestone Mar 4, 2014
@markstory markstory modified the milestones: 0.13, 0.11 Mar 22, 2014
markstory added a commit that referenced this pull request Mar 22, 2014
Add `ClosureCompiler` filter.
@markstory markstory merged commit b9d4812 into markstory:master Mar 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants