Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load img in scss #3

Open
annelyse opened this issue May 11, 2021 · 4 comments
Open

Load img in scss #3

annelyse opened this issue May 11, 2021 · 4 comments

Comments

@annelyse
Copy link

Hello,

How do you do to load image in scss file ?
I have an error can't resolve path

thanks !

@pixels-aromates
Copy link

Hello, same issue here, i don't understand how to load any files (images, fonts...) in scss file

@PieterBoghaert
Copy link

image
image

Install file-loader first: yarn add -D file-loader

@basmiddelham
Copy link

basmiddelham commented Feb 23, 2022

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');

@eugeneweblab
Copy link

@basmiddelham Hi! Can you share please you files structure in your project? I can't figure out how it should be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants