Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a warning about using string interpolation

  • Loading branch information...
commit 620997163fe5dbd2af75a5c96f676bc33597a49e 1 parent 5cd0dec
@exviva exviva authored
Showing with 12 additions and 1 deletion.
  1. +12 −1 README.rdoc
View
13 README.rdoc
@@ -29,7 +29,18 @@ Add the following to your Gemfile:
gem 'coffee-filter'
+=== Caveats
+Using Ruby interpolation within the +:coffeescript+ block will prevent Haml from caching the result of compilation.
+This means that your coffeescript block will be compiled by the coffeescript engine on runtime during every request,
+which is something you'll definitely want to avoid (since it's orders of magnitude slower).
-Copyright (c) 2011 Paul Nicholson, released under the MIT license
+In other words, using constructs similar to this:
+
+ :coffeescript
+ @server_time = #{Time.now.to_i}
+will cost you around 100ms on each request. Either use the +:javascript+ filter for this,
+or embed the dynamic content in some other way in the DOM.
+
+Copyright (c) 2011 Paul Nicholson, released under the MIT license
Please sign in to comment.
Something went wrong with that request. Please try again.