popupjs | W3C HTML5 Dialog | User Interface library
kandi X-RAY | popupjs Summary
kandi X-RAY | popupjs Summary
W3C HTML5 Dialog Plus
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of popupjs
popupjs Key Features
popupjs Examples and Code Snippets
Community Discussions
Trending Discussions on popupjs
QUESTION
There are a few SO posts about style-loader
and css-loader
, but despite this I have not been able to find a solution to my problem.
In short summary, when I @import
css
files in other css
files, and the imported css
contains url()
s with relative paths, the paths are not resolved correctly.
Basically, the error message shows that Webpack ends up thinking the url()
paths in the imported css are relative to src
(main entry point), rather than being relative to the css
file it it is imported into:
ANSWER
Answered 2018-Sep-09 at 18:54I was able to solve the problem myself. In case it could help others in the future, please find the solution below.
- First of all, if you are using both
postcss-loader
with thepostcss-import
plugin, ANDcss-loader
, turn off / delete thepostcss-import
plugin. You do not need more than one tool that resolves@import
rules. This is not really a problem if the order of loaders is correct, but you might as well remove it. - In the sass-loader docs, you can read the following:
Since Sass/libsass does not provide url rewriting, all linked assets must be relative to the output.
If you're just generating CSS without passing it to the css-loader, it must be relative to your web root.
If you pass the generated CSS on to the css-loader, all urls must be relative to the entry-file (e.g. main.scss).
More likely you will be disrupted by this second issue. It is natural to expect relative references to be resolved against the .scss file in which they are specified (like in regular .css files). Thankfully there are two solutions to this problem:
Add the missing url rewriting using the resolve-url-loader. Place it before the sass-loader in the loader chain.
Library authors usually provide a variable to modify the asset path. bootstrap-sass for example has an $icon-font-path. Check out this working bootstrap example.
I decided to follow bullet two, and add in resolve-url-loader
above sass-loader
in the Webpack config. It now works as expected.
My final Webpack config (for now) looks like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install popupjs
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page