Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove HTML comments in my Facelets?

I would like to remove all HTML comments from my facelets before delivering to end users. Does any standard approach exist?

like image 270
yegor256 Avatar asked Aug 02 '10 13:08

yegor256


People also ask

How do you remove comments from HTML?

There's nothing too much to explain this feature. It does what the title says, removes every HTML comment. Everything written between the <! -- beginning and --> closing tag is considered a comment.


1 Answers

There are actually two ways:

  1. To remove ALL comments, add this to web.xml:

    <context-param>     <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>     <param-value>true</param-value> </context-param> 

    or when you're still on JSF 1.2 which doesn't use Facelets as default view technology yet:

    <context-param>     <param-name>facelets.SKIP_COMMENTS</param-name>     <param-value>true</param-value> </context-param> 
  2. To remove specific comments only, use <ui:remove>.

    <ui:remove><!-- This is a HTML comment. --></ui:remove> 
like image 157
BalusC Avatar answered Oct 05 '22 14:10

BalusC