Browse files


  • Loading branch information...
1 parent b666cc1 commit efe1c862150b2fe4e0e679f87c4fa91d3493942a @aaronblohowiak committed Jul 14, 2012
Showing with 23 additions and 4 deletions.
  1. +23 −4
@@ -1,10 +1,29 @@
-== FORK!!!
-This is a fork of EJS in an effort to preserve line endings.
+I finally got sick of js templates that were all single-line obfuscated and indecipherable messes. Debugging was harder than it had to be so I scratched my own itch and rewrote the main compilation logic.
-All of the same tests pass, which is pretty cool.
+This is a fork of EJS preserves lines, so your line # in your js console should be the same as the line number in the actual template. This will also make it easier to set debugging points in your template.
-Unfortunately, the code got complicated and a little longer. I should probably factor it better, but it works and it is just a hairy 100 LOC, so..
+This is essentially a rewrite of the core compiler logic, though the interface is 100% compatible with upstream. In fact, I have not modified the tests at all (they still pass, of course!)
+I used the same gem name and reset the version to 1.0.0 so I could use it with rails-backbone.
+To use with rails-backbone instead of the default, just put
+ gem 'ejs', :git => ''
+above the line where you have:
+ gem "rails-backbone"
+and then `bundle install`
+*About the rewrite:* Unfortunately, the code grew about %25. The original version just runs gsub to escape special chars and then un-escapes them within the matching `<% ... %>` tags. Unfortunately, that didn't let you treat line endings differently outside of the matching tags. So, in order to process the line endings in the rendered html template in a way that js can handle (no multi-line strings!) I had to convert it from a simple three-pass gsub! to a more complicated system that essentially splits the source code and treats each section appropriately.
+I am more than interested in accepting pull requests that clean up the code while making the tests pass.
EJS (Embedded JavaScript) template compiler for Ruby

0 comments on commit efe1c86

Please sign in to comment.