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

[sass|scss] support css variables to property #877

Open
tamascsaba opened this issue Sep 22, 2016 · 15 comments · May be fixed by #1302
Open

[sass|scss] support css variables to property #877

tamascsaba opened this issue Sep 22, 2016 · 15 comments · May be fixed by #1302

Comments

@tamascsaba
Copy link

If I use css variables:

.element {
  --main-bg-color: brown;
}

sass-lint throw: no-misspelled-properties

@tamascsaba tamascsaba changed the title support css variables to propertie support css variables to property Sep 22, 2016
@eugef
Copy link

eugef commented Dec 12, 2016

With the version 1.10 I am having following error when using css variables:

413:1  error  Please check validity of the block starting from line #413  Fatal

So it is not an enhancement anymore but an issue

@dimanech
Copy link

Have the same issue. Since CSS custom property not equal to Sass variables we have too many reasons to have both in sass file.

@DanPurdy
Copy link
Member

Hi guys, you need to report this to Gonzales-pe which is the AST we use.

The fatal errors you're encountering are because the AST doesn't currently support CSS variables / modules

@eugef
Copy link

eugef commented Dec 14, 2016

Seems like this issue is related tonyganch/gonzales-pe#197

@HHogg
Copy link

HHogg commented Dec 14, 2016

If this is any help to anyone, I've managed to get around this by changing

:root {
  --custom-var: white;
}

to

:root {
  #{--custom-var}: white;
}

Not great but it suppresses the error thrown for the time being. I've not found any issues yet.

@bgriffith bgriffith changed the title support css variables to property [sass|scss] support css variables to property Aug 28, 2017
This was referenced Aug 31, 2017
@Rjervis3
Copy link

@HHogg , Thanks, your solution works!

@robsterlini
Copy link

@HHogg, have you found a way to handle multiple vars within a single block? I get a no-duplicate-properties error thrown by the linter with:

.foo {
  #{--bar}: red;
  #{--baz}: blue;
}

@HHogg
Copy link

HHogg commented Oct 8, 2018

Sorry @robsterlini I cant remember. I stopped using Sass a couple of years ago, and swapped to PostCSS/CSS Next.

@alexmccabe
Copy link

Is there any progress on this?

@Snugug
Copy link
Member

Snugug commented Oct 30, 2018 via email

@nwpappas
Copy link

Related:

Request to allow the no-color-literals rule to accept css var() statements.

no-color-literals:
  - allow-css-variables: true

Would allow:

.background {
  background-color: rgba(var(--my-background-rgb), var(--my-background-alpha));
}

@shennan
Copy link

shennan commented Feb 22, 2019

Would it be possible to get an update on the progress of this issue? It's been almost 3 years since the bug was reported.

@nelson6e65
Copy link

Seems that this (tonyganch/gonzales-pe#290) had been resolved by tonyganch/gonzales-pe#295

@Stephane-Pires
Copy link

@robsterlini Have you find a fix for no-duplicate-properties on css variables

i'm still getting the no-duplicate-properties error

@robsterlini
Copy link

@robsterlini Have you find a fix for no-duplicate-properties on css variables

i'm still getting the no-duplicate-properties error

Sadly not, I have been using // sass-lint:disable to force those rules to be ignored in those instances.

@TheJaredWilcurt TheJaredWilcurt linked a pull request Apr 9, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.