views:

105

answers:

1

in HAML, we can write comments using

-# some comment and it won't become HTML and made public

but if it is inside

:javascript
  -# comments like this line will break the javascript interpreter as it becomes javascript code
  // so we are forced to use comment like this and is publicly viewable

is there a way to make it non-public?

+1  A: 

Short answer: no.

Long answer: filters in Haml aren't processed by Haml at all, they're simply sent off to the relevant filter processor. For :javascript, this is a simple processor that just wraps up the text in script tags. There's no support for anything fancy like removing comments. If you want something like that, I'd suggest adding a custom filter that uses some sort of Javascript minifier.

nex3
seems like the things inside :javascript filter, the #{i} will be evaluated... maybe that's the only thing? <%= i %> won't work either.
動靜能量