ThisIsManta / stylus-supremacy

A Node.js script that helps formatting Stylus files.
https://thisismanta.github.io/stylus-supremacy
MIT License
88 stars 9 forks source link

Inconsistently removed colons (another edge case) #85

Open qnp opened 3 years ago

qnp commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

qnp commented 3 years ago

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

ThisIsManta commented 3 years ago

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