inline background-image (require)
maksym5 opened this issue · comments
maksym5 commented
Hi
How can i add background-image
inline with require on my pug-file? I try style='background-image:url(' + require("./images/") + ')'
but get error Module build failed: TypeError: require is not a function
My pug cfg:
{
test: /\.pug/,
loaders: ['html-loader', 'pug-html-loader']
}
pack. versions:
"pug-html-loader": "1.1.5"
"html-loader": "0.5.1"
"webpack": "3.5.5"
Thanks
Miguel Palau commented
Try:
html-loader?interpolate
Jesse Hoffman commented
Hmm tried this, but I think the interpolation would need to happen in the pug-html-loader
, not the html-loader
. Looks like there is no iterpolation support for this currently.
Miguel Palau commented
it needs to happen in both just like sourcemaps with sass, css, and style loader