ruby-ejs icon indicating copy to clipboard operation
ruby-ejs copied to clipboard

Allow to use a custom function to compile the escape pattern (<%- %>)

Open byroot opened this issue 12 years ago • 3 comments

EJS.escape_function is now a formatting string. Example:

EJS.escape_function = '_.escape(%s)'

byroot avatar Nov 26 '12 21:11 byroot

And since _.escape and friend already take care of the string coercion https://github.com/documentcloud/underscore/blob/master/underscore.js#L1040 maybe we can let this responsibility to escape_function.

byroot avatar Nov 26 '12 21:11 byroot

Wow, I'd love to have this in the gem. Looks great.

percyhanna avatar Jan 31 '13 18:01 percyhanna

+1

using a custom escape_function really cuts down on our compiled template size. since Underscore is already available in our app just using _.escape vs 6 inline replace statements is a pretty quick win!

wireframe avatar Feb 20 '13 16:02 wireframe