Skip to content
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

[Proposal] Remove legacy monkey-patch functions #3214

Closed
matthew-dean opened this issue Jun 2, 2018 · 5 comments
Closed

[Proposal] Remove legacy monkey-patch functions #3214

matthew-dean opened this issue Jun 2, 2018 · 5 comments

Comments

@matthew-dean
Copy link
Member

Earlier versions of Less offered support for CSS functions that weren't yet supported cross-browser, acting as a de facto Babel-esque (although pre-Babel) polyfill for future CSS syntax.

However:

  1. Many of these functions are no longer needed, such as the poly-filled color functions. See: https://caniuse.com/#feat=css3-colors
  2. These monkey-patched functions are now failing at newer features added to CSS, such as custom property values. See: Custom properties inside builtin functions like rgba() throw error #2986

Functions that still act as polyfills (don't have cross-browser support) should be discussed, but IMO well-supported functions should stop being polyfilled, and future Less versions should probably not try to polyfill CSS functions.

@seven-phases-max
Copy link
Member

seven-phases-max commented Jun 2, 2018

It depends on what you mean with "polyfilled". Note for example the built-in rgba is not really a polyfill simply because of something like darken(rgba(1, 2, 3, .4), 5%) <- here it must be evaluated as a Less function that accepts some args (numbers in a simple case) and returns a built-in color object for a further manipulation.

After all also note foo: rgba(1, 2, 3, .4); compiles to foo: rgba(1, 2, 3, .4); so I'm not quite sure where you got this idea of these functions being a polyfills at all.

In a long run I guess we could consider to return to a generic idea (mentioned many times here and there in various issues) of "not evaluating things until they are actually used" but it's something more complex than just "removing" rgba et al functions.

@matthew-dean
Copy link
Member Author

It depends on what you mean with "polyfilled". Note for example the built-in rgba is not really a polyfill simply because of something like darken(rgba(1, 2, 3, .4), 5%) <- here it must be evaluated as a Less function that accepts some args (numbers in a simple case) and returns a built-in color object for a further manipulation.

That's a good point. So if we need to evaluate it sometimes, we can't really remove the function. 🤔

In a long run I guess we could consider to return to a generic idea (mentioned many times here and there in various issues) of "not evaluating things until they are actually used" but it's something more complex than just "removing" rgba et al functions.

Yeah maybe that's the better approach.

@matthew-dean matthew-dean changed the title [Proposal] Remove legacy monkey-patch functions [Discussion] How to deal with CSS functions w/ custom properties Jun 4, 2018
@matthew-dean matthew-dean changed the title [Discussion] How to deal with CSS functions w/ custom properties [Proposal] Remove legacy monkey-patch functions Jun 4, 2018
@matthew-dean
Copy link
Member Author

I renamed this but I think I'll close this in favor of discussion at #2986.

@shrpne
Copy link

shrpne commented Jun 7, 2018

@matthew-dean @seven-phases-max
How about renaming Less color functions to something with a prefix?
For example: toRgba, makeRgba, colorRgba etc.
So they will not conflict with CSS functions.

@seven-phases-max
Copy link
Member

seven-phases-max commented Jun 8, 2018

@shrpne I think that will very spoil the very purpose of the whole thing. It's not just about "some Less functions" - it's about The Colors (as universal thing) in Less. It's not some rgba or so, it's also the same thing with any other color representations like #123, red and so on (will you also purpose some less-hex-color(123), less-red and etc?). There's no point in having things like:

@some-color: *any ordinal value here*; // please don't force me to use some freaking crypted garbage here, it's not what I installed Less for and bother with it at all 
/*

































*/
foo {
   bar: darken(@some-color, 5%);
}

Yes, it may be conflicting with some newest CSS stuff but that's what things like #2986 are for.

For the rest honestly I don't see the point in using Less then at all. For 100% CSS-compatibility one just uses CSS. If we are for some superset language we automatically agree it may be incompatible (hopefully temporary) at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants