A
A
Anton A2020-07-18 14:26:57
css
Anton A, 2020-07-18 14:26:57

How to correctly set the path to the icon in the background-image using styled-components, React and Parcel?

I use React, Parcel, styled-components.

I want to inline the icon in the background-image that is in the assets folder.

background-image: url('../../assets/images/check.svg');
- doesn't work like that

import img from '../../assets/images/check.svg';
...
background-image: url(${img});
- so too, in the background-image inspector: url([object Object])

Tell me, maybe there is a plugin that I could not find, or is it easier to do it manually?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question