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
[Bug] : Warnings when Font-Face declaration contains inline SVG #1040
Comments
PR welcome |
I would, but I don't know if this is still an issue with 5.0.0-rc2 |
I think this problem on both versions, i.e. |
keep track if this was fixed: cssnano/cssnano#1040 and then remove the fallback
Close #1040 Skip non-svg data urls even in the case the same declaration also contains svg. Previously the code assumed declaration only contained one uri.
It is still a bug on master and so on 5.0.0-rc2. I have opened #1043 to fix this. |
True, I spend a bit of time to investigate this. The problem indeed, only occurs if We bundle our webpack logic in a single package to use in all our projects, and in this bundle itself cssnano is installed as "4.1.10" (locked by the package.lock file), while in the project itself it gets installed as |
Describe the bug
I'm using cssnano not directly, but as a dependency through "css-minimizer-webpack-plugin". I'm getting warnings like this, after upgrading a project from webpack 4 to webpack 5 (which is probably not related, and only occurs because I updated the dependencies):
I have noticed, that there is a v 5.0.0 release candidate for "postcss-svgo" which might fix the problem? But I haven't tested that.
I'm currently running "postcss-svgo" v4.0.3
To Reproduce
As it is part of a larger project, I can't really provide an easy way to reproduce the problem, but bear with me.
My Font Face is written in SASS and looks like this:
Which gets processed by "sass-loader" and "post-css-loader" to look like this:
When "css-minimizer-webpack-plugin", in turn "cssnano" and "postcss-svgo" starts to parse the code, it will detect this as "svg" block, because this cirteria is met.
The problem, seems to be, that will now iterate over all url() definitions and automatically assume that each of them is an inline svg definition. Which leads to svgo passing even non svg-paths to the processor. The processor detects that it is not an svg and throws the warning.
The issue seems to be introduced by the commit that removed "is-svg"
Expected behavior
Some fallback should be implemented, that detects if a url is actually an svg or not.
I assume executing another one of those blocks inside the loop would fix the problem, without causing issues:
As a quick fix, I added /Css Minimizer Plugin: cssnano/ to the webpack filter warnings plugin
Screenshots
If applicable, add screenshots to help explain your problem. (from cssnano-playground)
Desktop (please complete the following information):
OS: Windows 10 10.0.19042
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 22.90 GB / 47.85 GB
Binaries:
Node: 14.5.0 - C:\Program Files\nodejs\node.EXE
npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD
Managers:
pip3: 19.2.3 - C:\Python38\Scripts\pip3.EXE
Utilities:
Git: 2.21.0. - C:\Program Files (x86)\Git\cmd\git.EXE
FFmpeg: 4.3.2 - C:\ProgramData\chocolatey\bin\ffmpeg.EXE
Virtualization:
Docker: 19.03.5 - C:\Program Files\Docker\Docker\Resources\bin\docker.EXE
SDKs:
Windows SDK:
AllowAllTrustedApps: Disabled
Versions: 10.0.18362.0
Languages:
Python: 3.8.3 - C:\Python38\python.EXE
Browsers:
Chrome: 89.0.4389.114
Edge: Spartan (44.19041.423.0), Chromium (89.0.774.68)
Internet Explorer: 11.0.19041.1
@labor/th-bingen@1.0.1 W:\work\th_bingen\website_relaunch\typo\app\src
+-- @labor-digital/asset-building@9.0.0-rc.5
|
-- css-minimizer-webpack-plugin@1.3.0 |
-- cssnano@4.1.11 deduped`-- cssnano@4.1.11 <- Installed manually to test if 4.1.11 fixes the issue
The text was updated successfully, but these errors were encountered: