Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Commit

Permalink
Add a warning about using string interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
exviva committed Jun 27, 2012
1 parent 5cd0dec commit 6209971
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -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 6209971

Please sign in to comment.