Closed jpsear closed 7 years ago
Gah, ignore me. The above seems to work just fine!
Actually, you've reminded me that this loader needs to be updated for Webpack 2.
But as to your question, you should be able to include the loader multiple times with different locals:
rules: {
{ test: 'path/to/one.ejs', use: {
loader: 'ejs-html',
options: { randomParams: 'abc' }
} },
{ test: 'path/to/two.ejs', use: {
loader: 'ejs-html',
options: { randomParams: '123' }
} }
}
If this doesn't work, it may just be that it needs updating, which I will do shortly. I'll be sure to include a test case for this scenario.
I'm aware that I can pass local variables into all ejs files using my loader configuration, but is it possible to do this when consuming each template file?
Without a loader (when not bundling), I was doing this:
Essentially, I want my locals to be able to change on a per-template basis...
Sorry if it's a slightly silly question!