wordpress-webpack-workflow
wordpress-webpack-workflow copied to clipboard
Load img in scss
Hello,
How do you do to load image in scss file ? I have an error can't resolve path
thanks !
Hello, same issue here, i don't understand how to load any files (images, fonts...) in scss file
Install file-loader first: yarn add -D file-loader
This worked for me:
Install file-loader first: yarn add -D file-loader
In config.base.js:
const imageRules = {
test: projectOptions.projectImages.rules.test,
use: [
{
loader: 'file-loader',
options: {
publicPath: '../images/',
outputPath: '../public/images/',
name: '[name].[ext]?[hash]',
},
},
],
}
In SCSS:
background-image: url('./../images/gif-placeholder.gif');
@basmiddelham Hi! Can you share please you files structure in your project? I can't figure out how it should be