Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Minify JavaScript and CSS with the help of Jetty?

Hi,

you can use WUIC: it's an open source project providing tools for compression with various libraries (closure and yuicompressor are good examples).
Build time and on the fly optimization are supported. A servlet is provided and can do everything for you, including caching and gziping the content.
A filter can also be installed to use HTTP/2 server-push when your HTML page is served.

Examples are here: https://github.com/wuic/wuic-samples
Doc is here: http://wuic.github.io/wuic-documentation.html

2016-07-18 13:23 GMT+02:00 Carey Evans <carey@xxxxxxxxxxxxx>:
On Mon, 18 Jul 2016, at 07:15, Emmeran Seehuber wrote:
> For state of the art JS compression you need uglifyjs2 - you can run it
> on Rhino and I think even on Nashorn. But it is *way* to slow for on the
> fly compression. Uglifyjs2 is already slow when running on node.js. But
> its even slower in the JVM…

We use a servlet wrapper around the Google Closure Compiler for
_javascript_ minification, as well as on-the-fly conversion from ES6 to
ES5. It's not *fast*, really, but it's fast enough.

It's not entirely separate from private parts of our code, but if
anyone's interested I could post the important parts.

> In our project we migrated away from pure CSS to SASS. You can run the
> original (ruby) sass in jruby without problems. But it is also very slow…
> But there is sassc to rescue here. I´ve build a static sassc binary for
> Linux and Mac OS X, which I embedded in my java project and just extract
> to a temporary folder to convert sass->css on the fly. This is very fast
> and even gives a good compressed/minified CSS.

We used to use Ruby Sass with JRuby for a while, but it was very slow
and caused problems with the application under load. Now we just use
libsass from Node.js and ship the compiled files.


--
  Carey Evans
  carey@xxxxxxxxxxxxx
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Guillaume DROUET

Back to the top