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

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

byroot
Copy link
Contributor

@byroot byroot commented Nov 26, 2012

EJS.escape_function is now a formatting string.
Example:

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

EJS.escape_function is now a formatting string.
Example: EJS.escape_function = '_.escape(%s)'
@byroot
Copy link
Contributor Author

byroot commented Nov 26, 2012

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.

@percyhanna
Copy link

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

@wireframe
Copy link

+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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants