Relative path images of SASS @import is not supported
See original GitHub issueChoose one: this is a 🐛 bug report.
💻 Code Sample
main.scss
@import '../components/topbar/index.scss';
topbar/index.scss
.topbar {
height: 60px;
background: #f60 url("./play.png") repeat;
font-size: 2em;
}
🤔 Expected Behavior
main.css
.topbar {
height: 60px;
background: #f60 url("md5xxxxxxx.png") repeat;
font-size: 2em;
}
😯 Current Behavior
main.scss: Cannot resolve dependency './play.png'
🌍 Your Environment
Software | Version(s) |
---|---|
Parcel | 1.4.1 |
Node | 8.6.0 |
npm/Yarn | npm |
Operating System | macOS 10.12.6 |
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:22 (4 by maintainers)
Top Results From Across the Web
SCSS - usage of image files with relative path are not working
import './../scss/main.scss'. When I try to build this project with webpack, I get an error, that the image.png file can not be resolved....
Read more >sass-loader - webpack - JS.ORG
The loader will first try to resolve @import as a relative path. If it cannot be resolved, then the loader will try to...
Read more >How to avoid long relative paths import in your angular app
This looks weird, this nesting path depends on how deep your component is, where you are importing the variables scss/less file.
Read more >CSS - Parcel
CSS assets can contain dependencies referenced by @import syntax, as well as references to images, ... relative paths are not allowed in custom...
Read more >Relative Paths Not Working in SCSS file in Visual Studio Code ...
On his MacBook, my colleague has added import statements to his SCSS files like this: @import '~styles/_Mixins';.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello, I had a similar problem with this kind of import
@import '../node_modules/@ibm/plex/scss/ibm-plex.scss';
,got solved by wrapping it with
url()
@import url('../node_modules/@ibm/plex/scss/ibm-plex.scss');
Thanks!
I’ve been getting around it importing media, ie:
And then inserting those where necessary with js. Not sure if that’s of any help @spion