user6223586
user6223586

Reputation:

Remove comments from CSS and JavaScript files in JSF page

Is there any configuration in JSF which I can configure JSF engine to skip comments in CSS and JavaScript files similar to xhtml files?

Upvotes: 1

Views: 271

Answers (1)

BalusC
BalusC

Reputation: 1109222

No. JSF doesn't offer this facility. JSF does nothing dynamic with JS files. The only dynamic thing which JSF does with CSS files is evaluating EL expressions, particularly in order to support resource mapping #{resource} in CSS files. See also a.o. How to reference JSF image resource as CSS background image url.

Your best bet is using a CSS and JS minifier. It not only removes comments, but can also compress it. A well known example is YUI compressor. There are even Maven plugins which automatically run it during build, such as Minify.

Upvotes: 2

Related Questions