-
Notifications
You must be signed in to change notification settings - Fork 24
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
Can I pass some parameters in require macro? #25
Comments
Hi, I don't think we currently support this but it looks like it would be really useful. Let me think how we can achieve this. The thing is that we might need to extend our current implementation of the require macro:
At first view, it might require to extend the arguments array with some given object... |
Hi @emaphp |
Hi @emaphp header.html
page-a.html
page-b.html
There will be throw a error from HtmlWebpackPlugin: Because of require macro does not provide arguments in page-b.html. but header.html needs it... Or should I commit this issue to HtmlWebpackPlugin? |
Not sure how that plugin works. I might take a look at it. Could you provide more information about what are you trying to achieve? thx |
It happened like this: If require macro not provide arguments. The elements (required arguments) will not renders in template (header.html) In the comments above. page-b.html does not provide aruments in require macro. So it only renders There will be a problem with HtmlWebpackPlugin. It will evaluate the html factory and replace it with its content once everything is compiled. If an undefined variable is present. it is throw error. If the HTML template received by HtmlWebpackPlugin has been replaced by the underscore-template-loader compiler. It will be fine? |
Is there any problem or is not clear of my description? My English is not good, I had tried to say that I can say it and I hope I can got your response about my issue. For better or for worse. Looking forward to your response. |
@Monine no worries, it is clear to me that this is happening while using the HtmlWebpackPlugin. Not an expert on that though. I'll let you know if I can come up with something. |
Hi, the thread is quite old but still open, just came across it and wanted to share my solution for the problem of
|
I have a header.html template, It is used on every page, and each page has some differences. This is easy to implement if I can pass some parameters in require macro, like:
index.html
How can I achieve this?
The text was updated successfully, but these errors were encountered: