-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
inlineStyles plugin keeps unused style when onlyMatchedOnce: false #1761
Comments
Maybe there is another way to clean unused classes? |
It seems it is related #1743 |
@SethFalco could you please check is this issue is fixed by #1800 |
Ahh, thanks for pinging me. I think this might indeed be fixed as well. Can you confirm the results and close the issue if it's resolved?
module.exports = {
multipass: true,
js2svg: {
indent: 2,
pretty: true,
},
plugins: [
{
name: 'preset-default',
params: {
overrides: {
inlineStyles: {
onlyMatchedOnce: false,
},
},
},
},
],
}; I get this with main (b15da27): <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 120.1 138.8" viewBox="0 0 120.1 138.8">
<path d="M60.1 0 0 34.7v69.4l60.1 34.7 60-34.7V34.7L60.1 0zm42.2 93.8L60 118.2 17.8 93.8V45l42.3-24.4L102.3 45v48.8z" style="fill:#002d74"/>
<linearGradient id="a" x1="90.117" x2="90.117" y1="1.087" y2="70.488" gradientTransform="matrix(1 0 0 -1 0 139.89)" gradientUnits="userSpaceOnUse">
<stop offset="0" style="stop-color:#002d74"/>
<stop offset="1" style="stop-color:#002d74;stop-opacity:0"/>
</linearGradient>
<path d="m60.1 138.8 60-34.7V34.7L60.1 0v20.6L102.3 45v48.9L60 118.3v20.5z" style="fill:url(#a)"/>
<linearGradient id="b" x1="30.023" x2="30.023" y1="139.89" y2="70.488" gradientTransform="matrix(1 0 0 -1 0 139.89)" gradientUnits="userSpaceOnUse">
<stop offset="0" style="stop-color:#002d74"/>
<stop offset="1" style="stop-color:#002d74;stop-opacity:0"/>
</linearGradient>
<path d="M60 0 0 34.7v69.4l60 34.7v-20.6L17.8 93.8V44.9L60 20.6V0z" style="fill:url(#b)"/>
<path d="m88.1 85.6-28 16.2L32 85.6V53.2L60.1 37l28 16.2L76.4 60 60 50.5 43.7 60v18.9l16.4 9.5 16.4-9.5 11.6 6.7z" style="fill:#002d74"/>
</svg> Metrics
|
It is fixed! Looking forward for the release 😉 |
@SethFalco when is the release planned? |
I've messaged one of the other maintainers about it this week. I don't have permissions to make releases yet. I just joined as maintainer last week, so as soon as they have time they'll review what I've done and either make the release or grant me permission to. Reference: While the release is pending, I'm working on revamping our documentation. 👍🏽 |
I've just released v3.0.3 on npm! Feel free to open a new issue if you run into any problems. 👍🏽 |
Describe the bug
I've faced with strange side effect that
inlineStyles
plugin keeps unused style when optiononlyMatchedOnce: false
.To Reproduce
Steps to reproduce the behavior:
onlyMatchedOnce
tofalse
Expected behavior
All styles inlined and removed from
<style>
element.Actual behavior
Unused style present in
<style>
element.Original svg
Optimized svg with
onlyMatchedOnce: false
st2
class not used and already inlined but present in<styles>
element.Optimized svg with
onlyMatchedOnce: true
(default)As expected all styles used once was inlined.
Desktop (please complete the following information):
Additional context
Note:
minifyStyles
doesn't help too.The text was updated successfully, but these errors were encountered: