Passing locals
kpapadatos opened this issue · comments
Im trying to use this and its not working at all
{
loader: "pug-html-loader",
options: {
pretty:true,
exports:false,
data: {foo:"BAR"}
}
}
In my pug template im trying to access data.foo
and webpack compiler is saying error accessing property foo of undefined
+1 on this, doesn't seem to work at all, but
- Seems pretty important to the core functionality of what a pug html loader should do.
- Doesn't seem like it should be too tricky to do
Just submitted a little patch I've been using.
- Yup
- It's all relative, thanks @willyelm et al. for the slick project.
😉 👍
it should be working in the latest version which webpack version are you using? also please paste how does your web pack config look like. Thanks!
I just tested it - i was trying to access data.foo
in the pug, turns out its just foo
:/
So it does work. I could have sworn I saw something somewhere that said to use data.foo
to access the locals, which is why I assumed this wasnt working?
Might be worth making an example of how to use the data
option in a template, since it seems a few of us have made the same mistake :)
great, I'll close the issue then. I've added it to the readme. Thanks!
Yes just to confirm, I was using with ExtractTextPlugin and it was a bug with that, not pug-html-loader. So thanks! All good.