Comments (8)
@ygoe Could you please provide an example? The single case I can imaging is a value of custom property.
from csso.
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.
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.
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.
What's the difference of these additional spaces? I'm not aware of any situation where it's relevant.
from csso.
getComputedStyle(node).getPropertyValue('--x')
returns the untrimmed value
from csso.
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.
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)
- @import statement on the bottom were removed HOT 1
- Wrong css property applied after restructuring
- Contents of the :is and :where pseudo-class functions is not optimized HOT 3
- ccoss
- how disabled colormin?
- csso ignores charset and always produces UTF-8
- Wrong border compressed result when with shorthand-border
- Shorten CSS Variable Names
- [bug] minifies removes @media tags HOT 4
- Update `css-tree` dependency HOT 2
- Minifying 0px within calc statements breaking site.
- Failure to Concatenate/Combine 2 CSS Selectors in Obscure Edge Case
- Duplicate content property removed
- Add support for CSS Nesting
- css
- Silently removes @media blocks containing "and (not ...)" HOT 3
- A bug with restructuring and shorthands
- CSS error breaks optimization HOT 2
- CSS
- TypeError: console.warn is not a function (ExecJS::ProgramError) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csso.