-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to keep Template Strings From Being Processed? #1462
Comments
The documentation for lodash indicates that https://lodash.com/docs#template so for example: replacements: [{
from: 'something',
to: '<script src="\\<%=ConfigurationManager.AppSettings("something")%\\>"></script>'
}] |
@nycdotnet the problem is that those output like:
instead of
Not sure why it's keeping the extra slash in there. |
It's most likely upstream issue. Did you try to test it with native lodash |
@ArmorDarks Sort of. This adds a slash (making it a single backslash outputs fine though..): let x = _.template('test <%= test %>!');
x({ test: '<script src="\\<%=ConfigurationManager.AppSettings("something")%\\>"></script>' });
// output: "test <script src="\<%=ConfigurationManager.AppSettings("something")%\>"></script>!" |
Oh, now I see why it doesn't work. Here is example from docs: // Use backslashes to treat delimiters as plain text.
var compiled = _.template('<%= "\\<%- value %\\>" %>');
compiled({ 'value': 'ignored' });
// ➜ '<%- value %>' Please, note that you should wrap escaped template into template tags too to make it work. _.template('\\<%- value %\\>')()
\\ returns `\<%- "value" %\>`
_.template('<%= "\\<%- value %\\>" %>')()
\\ returns `<%- value %>` Though, what is really strange, while So, in the end of all, it's Grunt's issue. |
@ArmorDarks thanks for writing that out, that helps. So, now, where in the Grunt code should this be fixed, do you think? |
Simple question: is it possible to keep template strings from getting processed?
I shouldn't have to do this:
The text was updated successfully, but these errors were encountered: