how do I use css background-image: url('...')
linking to /public directory in razzle v4?
#1729
-
❓QuestionI'm using One of my .less files has a
|
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 1 reply
-
background-image: url('../images/example.jpg'); ? |
Beta Was this translation helpful? Give feedback.
-
Sorry I forgot to mention that these images are in <project_dir>/public/images so I want them to not be bundled by webpack (they are too large) but just be fetched via http(s). That's why I just have Again, this worked in v3. Also using [email protected] but could easily switch to webpack@5 if it's easier to configure there. |
Beta Was this translation helpful? Give feedback.
-
This is the resolve-url-loader that sits between the less and the css loader. So remove that loader from the loader chain for less files. But this will disable the url resolving for all css url()’s not just the absolute ones. |
Beta Was this translation helpful? Give feedback.
-
Maybe ~/images/example.png works? |
Beta Was this translation helpful? Give feedback.
-
If you put up a simple example on codesandbox I can try fixing it for you :) |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help on this. Here is the reproduction: https://codesandbox.io/s/razzle-image-background-url-9j5pc?file=/src/App.less |
Beta Was this translation helpful? Give feedback.
-
https://codesandbox.io/s/razzle-image-background-url-forked-7vr22 - there :) |
Beta Was this translation helpful? Give feedback.
-
Thanks so much for your help!! |
Beta Was this translation helpful? Give feedback.
https://codesandbox.io/s/razzle-image-background-url-forked-7vr22 - there :)