-
-
Notifications
You must be signed in to change notification settings - Fork 206
How can I provide parameters for webpack html-loader interpolation? #122
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
Comments
@547377507 Currently not possible sry, I'm working on #120 for the next major of this loader, the README example is misleading here, it only shows that if template-string-loader/index.js import { getOptions } from 'loaderUtils'
module.exports = function (html) {
const options = getOptions(this) || {}
// html-loader etc following
if (this.loaderIndex > 0) {
const template = ($) => `${html}`
return template(options.locals)
}
// direct export to webpack as a module
return 'module.exports = function ($) { return `${html}`};'
} |
Thank you |
Is there any update on this? I found https://github.com/deepsweet/mustache-loader, which seems to achieve the goal. But I would like to stick with ES6 syntax |
Hi, I just created a package that might do what you are asking: I will create a new issue in this repository to talk about it. |
require("html?interpolate=require!./file.ftl");
<#list list as list>
${list.name}
</#list>
Where does "list" come from? How can I provide parameters to the interpolation scope?
I would like to do something like template-string-loader does:
var template = require("html?interpolate!./file.html")({data: '123'});
and then in file.html
Any ideas? Thank you
The text was updated successfully, but these errors were encountered: