开发者

How do I render obfuscated / minified / optimized HTML/CSS in Rails 3?

I'm using Rails 3 with HAML and SASS and I'd like to achieve the following goals:

  1. Obfuscate HTML and CSS output to make it a chore for a casual observer to reverse-engineer
  2. Optimize / minify the output to minimize browser load/parse time
  3. Keep source easy to read and understand

So if my HAML / SASS looks like this:

:sass
  .semantically开发者_StackOverflow社区-named-class {
    color: #ffffff;
  }

.some-container
  .semantically-named-class
    Some Content Here

I'd like my output to look something like this:

<html><head><meta>etc.etc.</meta><style type='text/css'>.azY13{color:#ffffff;}</style></head>
<body><div class='zzB79'><div class='azY13'>Some Content Here</div></div></body>

Are there any gems out there to help with this or will I have to roll my own?


Take a look at Jammit. It sounds like it accomplishes a lot of what you're looking for.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜