Skip to content
Browse files

Merge pull request #7 from exviva/add_remark_about_interpolation

Add a warning about using string interpolation
  • Loading branch information...
2 parents 5cd0dec + 6209971 commit 63a0b929b05407a751d460a32cab6c13f7c48d71 @paulnicholson committed Jun 27, 2012
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

0 comments on commit 63a0b92

Please sign in to comment.
Something went wrong with that request. Please try again.