stylus-supremacy icon indicating copy to clipboard operation
stylus-supremacy copied to clipboard

Inconsistently removed colons (another edge case)

Open qnp opened this issue 4 years ago • 4 comments

Hello,

I open another issue, related to #79 and the subsequent commit https://github.com/ThisIsManta/stylus-supremacy/commit/0734bec0c773b9dd663242edd32ab8b655274ad8. This commit cover properly the case of direct variable access:

color: $ui.colors.blue

However, when performing operations on such retrieved variables using built-in or custom functions (or even CSS functions such as linear-gradient), like for instance:

color: darken($ui.colors.blue, 50%) // built-in function
background-color: linear-gradient(90deg, red 0%, $ui.colors.blue 100%) // CSS function compiled as is

stylus-supremacy will again remove the colon : causing then failing stylus compilation. Indeed, this stylus example compiles while this one does not.

Hence, we should perform a more robust check on whether the colon should be preserved.

I'll try to do to the PR according to your philosophy.

Best regards,

qnp avatar Feb 05 '21 16:02 qnp

I am working on a PR and I discover that such case is not covered too:

border: 1px solid $colors.red

(see this example which does not compile without colon.)

So I will address this issue at the same time.

qnp avatar Feb 05 '21 18:02 qnp

Here is the PR => https://github.com/ThisIsManta/stylus-supremacy/pull/86

qnp avatar Feb 05 '21 18:02 qnp

Hi @ThisIsManta, Haven't heard from you for a while...hope you are doing well. Have you had the opportunity to read about this issue and the subsequent PR ? Best regards

qnp avatar Feb 22 '21 09:02 qnp

^ sorry, I'm quite packed these days. I'll have a look this coming weekends.

ThisIsManta avatar Feb 22 '21 09:02 ThisIsManta