Giter Club home page Giter Club logo

Comments (8)

lahmatiy avatar lahmatiy commented on June 9, 2024

@ygoe Could you please provide an example? The single case I can imaging is a value of custom property.

from csso.

ygoe avatar ygoe commented on June 9, 2024

Indeed, I observed this with a custom property:

.something
{
  --link-hover-color-l: calc(var(--link-color-l)
  	+ max(0%, (100% - var(--link-color-l)) * var(--link-hover-lf))
  	- max(0%, var(--link-color-l) * (0 - (var(--link-hover-lf)))));
}

from csso.

lahmatiy avatar lahmatiy commented on June 9, 2024

Custom properties can contain any content, that's not a regular value but a part of it when substituted. Removing anything from a custom property may break something. So CSSO do nothing with such values for now. Probably we need to add an option to enforce optimisation for such value in case you are sure it doesn't break anything in your case.

from csso.

idoros avatar idoros commented on June 9, 2024

Custom properties currently get trimmed, which creates a different output for development/production modes:

.c {
  --x: aaa bbb ; 
  --y: zzz ; 
}
/* OUTPUT: removed whitespace before and after the custom properties values */
.c{--x:aaa bbb;--y:zzz}

Edit:
Although this is the opposite of what the author is requesting, I think that the default behavior should preserve the value as is, untrimmed, and an option could be added to select between preserve/trim/min-whitespace

from csso.

ygoe avatar ygoe commented on June 9, 2024

What's the difference of these additional spaces? I'm not aware of any situation where it's relevant.

from csso.

idoros avatar idoros commented on June 9, 2024

getComputedStyle(node).getPropertyValue('--x') returns the untrimmed value

from csso.

ygoe avatar ygoe commented on June 9, 2024

I still don't need those extra spaces and cannot imagine a scenario where I would ever need it. CSS usually doesn't preserve such spaces and any application that now does is highly unexpected and probably bad design.

from csso.

idoros avatar idoros commented on June 9, 2024

I take it back, looking at the csswg it seems that custom properties should be trimmed. Browser implementation currently fail in my case.

from csso.

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.