开发者

JSF2 resources - compression, minification

开发者 https://www.devze.com 2023-03-12 22:45 出处:网络
I have two questions about resources in JSF2: is there any way to set that all JSF2 resources (JS, CSS) should be compressed 开发者_如何学Go(gziped) or at least minified. (Something a la wro4j).

I have two questions about resources in JSF2:

is there any way to set that all JSF2 resources (JS, CSS) should be compressed 开发者_如何学Go(gziped) or at least minified. (Something a la wro4j).

And the second one: is there any way to force exclude some library? I am using in my admin system OpenFaces, but the JS dependency is included even in the user frontend pages, even thought I never use (or import namespace) there.

Thanks


Gzipping is more a servletcontainer configuration. Consult its documentation for details. In Tomcat for example, it's a matter of adding the compression="on" attribute to the <Connector> element in /conf/server.xml. See also Tomcat Configuration Reference - The HTTP Connector.

<Connector ... compression="on">

You can also configure compressable mime types over there.

Minification is more a build process configuration. If you're using Ant as build tool, you may find the YuiCompressorAntTask useful. We use it here and it works wonderfully.


As to OpenFaces, that's a completely different question and I also don't use it so I don't have an answer for you. I'd suggest to just ask that in a separate question. I don't see how that's related to performance improvements as gzipping and minification.


For what concerns OpenFaces I had the same problem and I solved unpacking the JAR, minifying the huge Javascripts manually and repacking the JAR. It allowed me to save about 70 Kb per request which were impacting performance on heavy load.

0

精彩评论

暂无评论...
验证码 换一张
取 消