Browse files

Add a warning about using string interpolation

  • Loading branch information...
exviva committed Jun 27, 2012
1 parent 5cd0dec commit 620997163fe5dbd2af75a5c96f676bc33597a49e
Showing with 12 additions and 1 deletion.
  1. +12 −1 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 = #{}
+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 6209971

Please sign in to comment.