I use webpack.js for build project: jade/scss/js/node.js My SCSS will be compiled to CSS:
//SCSS
.heading {
background: url("/img/bg.png");
}
//CSS
.heading {
background- image:url('data:image/svg+xml;base64,...');
image is available on url: http://localhost:3000/img/bg.png
But it's not displaying as background-image. I know that I should use url/file-loader to include images in css next config works, but I can't use images in scss/css files
{
entry: "./src/js/main.js",
devtool: "source-map",
output: {
path: __dirname + "/public",
filename: "bundle.js"
},
module: {
loaders: [
{
test: /\.css$/,
loaders: ["style", "css"]
},
{
test: /\.scss$/,
loaders: ["style", "css?sourceMap", "sass?sourceMap"]
},
{
test: /\.png$/,
loaders: ["url-loader", "file-loader?sourceMap"]
}
]
}
}