willyelm / pug-html-loader

Pug HTML loader for webpack

Home Page:https://github.com/willyelm/pug-html-loader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

inline background-image (require)

maksym5 opened this issue · comments

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

Try:

html-loader?interpolate

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.

it needs to happen in both just like sourcemaps with sass, css, and style loader