最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ruby on rails - In HAML, how to write comments in :javascript region so that comments do not show to the public? - Stack Overflo

programmeradmin6浏览0评论

in HAML, we can write ments using

-# some ment and it won't bee HTML and made public

but if it is inside

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

is there a way to make it non-public?

in HAML, we can write ments using

-# some ment and it won't bee HTML and made public

but if it is inside

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

is there a way to make it non-public?

Share Improve this question edited Feb 20, 2013 at 10:51 nonopolarity asked Jun 3, 2010 at 22:22 nonopolaritynonopolarity 151k142 gold badges489 silver badges781 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 12

#{}- blocks are evaluated, so you can write

#{ # this is a ruby ment, but still a ment (newline is required)
}

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 ments. If you want something like that, I'd suggest adding a custom filter that uses some sort of Javascript minifier.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论