-
-
Notifications
You must be signed in to change notification settings - Fork 29
allow delimeter specification #55
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
allow delimeter specification #55
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi great suggestion, could you please make a few changes
lib/index.js
Outdated
@@ -21,6 +21,7 @@ module.exports = (options = {}) => { | |||
let subtree; | |||
let source; | |||
let locals = false; | |||
const delimiters = options.delimiters || ['{{', '}}']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth creating a separate settings object for posthtml-expressions
const posthtmlExpressionsOptions = {
locals: false
}
Pay attention to the locale, it will be necessary to override the used local variable locals
to the link to the options object posthtmlExpressionsOptions.locals
if (options.delimiters) {
posthtmlExpressionsOptions.delimiters = options.delimiters
}
so we will be sure that nothing will break if u posthtml-expressions
the default value will change delimiters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Scrum updated. How does this look now?
753454e
to
4bcb79b
Compare
@deiay publish v1.6.0 |
Posthtml-include uses posthtml-expressions to detect local variables passed into include blocks. The default variable syntax for posthtml-expressions is {{ my_variable }}. However, many JavaScript frameworks use
{{
and}}
as expression delimiters for their own uses which would clash with posthtml-expression's variable injection. posthtml-expressions allows for the configuartion of variable delimiters to solve this.This change allows for the passing in of a delimiter option that will get passed to posthtml-expressions. This lets us change the delimter that's used for variables in out includes.