Code Monkey home page Code Monkey logo

Comments (12)

tml avatar tml commented on August 10, 2024

So would it work if this:

.SB-messages .SB-message a {
    color: rgb(185, 99, 117);
    border-bottom: 1px dotted rgb(185, 99, 117;
    text-shadow: 0 1px 0 hsla(0, 0%, 0%, 1);
}

.SB-messages .SB-message p {
    color: rgb(185, 99, 117);
    border-bottom: 1px dotted rgb(185, 99, 117;
    text-shadow: 0 1px 0 hsl(0, 0%, 0%);
}

were minified to this?

.SB-messages .SB-message a{color:#b96375;border-bottom:1px dotted rgb(185,99,117;text-shadow:0 1px 0 hsla(0,0%,0%,1}.SB-messages .SB-message p{color:#b96375;border-bottom:1px dotted rgb(185,99,117;text-shadow:0 1px 0 hsl(0,0%,0%}

from yuicompressor.

whoughton avatar whoughton commented on August 10, 2024

The % look correct now, but you lost a couple of parens, the correct should be something like:

.SB-messages .SB-message a{color:#b96375;border-bottom:1px dotted rgb(185,99,117);text-shadow:0 1px 0 hsla(0,0%,0%,1}.SB-messages .SB-message p{color:#b96375;border-bottom:1px dotted rgb(185,99,117);text-shadow:0 1px 0 hsl(0,0%,0%)}

Oh, actually I lost the parens in the original it looks like.

from yuicompressor.

tml avatar tml commented on August 10, 2024

Now you're missing parens in the result, as well. Could you take the time to write a pre and post minified test case?

from yuicompressor.

whoughton avatar whoughton commented on August 10, 2024

Let me remove the extraneous elements:

.color_chip {
    color: hsla(27, 100%, 50%, 1);
    background: rgba(195, 198, 214, 0.85);
}

Would optimally compress to:

.color_chip{color:hsl(27,100%,50%);background:rgba(195,198,214,.85)}

The following elements are involved:

  • HSL requires percentages on saturation and lightness (the second and third elements)
  • HSLA was minimized to HSL as the opacity was 1
  • RGBA has an alpha, so it was kept, but the leading 0 was removed as it is non-necessary
  • The trailing semicolon was also removed (I believe this is already done)

from yuicompressor.

tml avatar tml commented on August 10, 2024

This is a great test with lots of moving parts, but doesn't it fail to test the primary issue raised here - that being the % being dropped in HSL(A?) functional notation? And if so, would fixing this be as simple as change the second value in hsla() to a 0%?

from yuicompressor.

whoughton avatar whoughton commented on August 10, 2024

Not sure what you mean, sorry. The idea I was going under was just what a valid input is and the corresponding valid output should be in a successful case.

To step back to the original issue, it is actually as simple as:

Valid input is provided:

.style {
    color: hsla(0, 0%, 20%, 0.75);
}

The current compressor is removing the "%" symbols from the HSL(A) values, corrupting them, producing:

.style{color:hsla(0,0,20,.75)}

The correct minified form (both the saturation and lightness, 2nd and 3rd components, are percentages) should be:

.style{color:hsla(0,0%,20%,.75)}

Sorry if I confused with my previous text case.

from yuicompressor.

tml avatar tml commented on August 10, 2024

Please see ae7ca5d48 - if you feel this doesn't adequately test what you were looking for, a PR is welcome!

from yuicompressor.

elstob avatar elstob commented on August 10, 2024

I'd just like to add this is an issue for RGB values as well.

.style {
    color: rgb(0%, 50%, 50%);
}

compresses to

.style{color:rgb(0,50%,50%)}

which is not a valid colour value apparently. Instead the 0% needs to remain as such, i.e:

.style{color:rgb(0%,50%,50%)}

Hope that helps.

from yuicompressor.

tml avatar tml commented on August 10, 2024

tests for rgb added; thanks, @elstob

from yuicompressor.

MightyPork avatar MightyPork commented on August 10, 2024

is there any workaround for this issue? It's destroying my CSS and I don't know how to solve it

from yuicompressor.

hamzehdoostie avatar hamzehdoostie commented on August 10, 2024

How anyone could use this compressor for "advanced" styles is beyond me. It breaks css.
On top of that I do not see any way to configure it with options to turn off Zero Values

from yuicompressor.

vezult avatar vezult commented on August 10, 2024

I'd like to point out that the target output in ae7ca5d is the optimal one (hsl(27,0%,50%);). However, it seems like non-broken output should be higher priority, meaning hsla(27,0%,50%,1); would be sufficient.

from yuicompressor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.