K
K
KnightForce2017-04-07 01:47:51
Sass
KnightForce, 2017-04-07 01:47:51

webpack. Sass-loader incorrectly specifies path for url() in css. Why?

Part of the config.
output:

output: {
   path: path.join(__dirname, 'public'),
   filename: '[name].js',
   publicPath: '/public/',
},

file loader:
{
     test: /\.(png|jpg|svg|ttf|eot|woff|woff2)$/,
     use: "file-loader?name=[path][name].[ext]",
}

All the files are thrown into their places, the assembly is assembled without errors.
The files are as follows:
style.scss: frontend/stylesheets/style.scss
Images: frontend/images/icons
I specify in the sass file In the output css file: What to do with it? background: url(../images/icons/image,png)
background: url(/public/images/icons/search.png)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vlad Feninets, 2017-04-07
@KnightForce

sass is compiled using the loader, and the loader "eats" the path from the webpack config

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question