-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(template): support custom template params #830
Conversation
Right now this is already possible by accessing |
Yes, however we are building a tooling layer using html-webpack-plugin internally, and would like to expose to the users some variables that are easier to access (and less confusing), especially when the variable may be used many times in the template. e.g. in We have similar needs in |
I would also appreciate the ability to do this without using the Another thing I'm using It also seems like a code smell that my template has to know about the fact that I'm using Webpack at all, let alone which plugins I'm using. |
The original intend of the long name was to be explicit. New devs in an existing project should be able to find their way to the variable origin. |
@jantimon I am using
|
If we would merge it this would mean that any addition to the template parameters might conflict with someone’s configuration. |
I understand the concern - but I think future additions should be nested under Not pushing anything, but I'd love to be able to expose something as concise as possible for the end user. |
I would love to get rid of the getStats call for performance reasons. Your proposed new templateParams could be empty, an object or a function. If it’s empty it would be the same like today (just without the stats) |
I like that, sounds very flexible. |
@yyx990803 @eezatron I prepared a new feature in #904. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This allows the user to inject custom variables to be used in the template interpolation, e.g. simplifying
webpackConfig.output.publicPath
to something shorter.Docs/tests are not included, but if this sounds like a good idea I can add those upon request.