R
R
ralo2017-05-11 09:58:15
JavaScript
ralo, 2017-05-11 09:58:15

Enable inline background webpack?

There is such a div with an inline background style! how to connect it so that webpack can see it!

<div style="background-image: url('./img/somthing-image.jpg') "></div>

this code works for me and will include this image in the assembly,
but I need it inline
img(src=require("../img/somthing-image.jpg"))

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
imdeveloper, 2018-07-11
@Aslamb

Parse and send JSON - this will be the right option. Example :

var array = [1, 2, 3];

localStorage.setItem("array", JSON.stringify(array));
array = JSON.parse(localStorage.getItem("array"));


console.log(typeof array); //object
console.log(array); //[1, 2, 3]

P
Polina, 2019-01-16
@paulinekorkina

To do this, you need to set the url as follows:
At the same time, use the interpolate flag in the webpack config:

{
  test: /\.html$/,
  use: ['html-loader?interpolate']
},

Stackoverflow solution https://stackoverflow.com/questions/44096749/webpa... I sincerely thought that it didn't work for me, it turns out I had to restart watcher and dev server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question