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

[CSS] Support custom properties (css variables) #197

Closed
tonyganch opened this issue Jul 11, 2016 · 6 comments
Closed

[CSS] Support custom properties (css variables) #197

tonyganch opened this issue Jul 11, 2016 · 6 comments
Assignees

Comments

@tonyganch
Copy link
Owner

https://www.w3.org/TR/css-variables/

@tonyganch
Copy link
Owner Author

From Sass 3.5 announcement:

So we decided on a compromise: we'd treat custom properties like we do selectors and at-rule values, and only allow #{} as a means of including Sass values. While technically this is plain CSS, it's a very small surface area and it's very easy to escape, so we're not too worried. This means that in 3.5 you can write:

 :host {
  --my-toolbar-theme: {
    background-color: #{$toolbar-background};
    border-radius: 4px;
    border: 1px solid gray;
  };
}

@eugef
Copy link

eugef commented Dec 14, 2016

Right now parsing the css variable like --my-var: #ffffff gives an error Please check validity of the block starting from line

@hopefuture
Copy link

+1

@bgriffith
Copy link
Collaborator

bgriffith commented Aug 20, 2017

Any thoughts on how to approach custom properties on a node level?

Would --my-var: #ffffff parse like a standard property? or would it have a customProperty node type?

-> declaration
| -> property
| | -> ident
| |    "--my-var"
| -> propertyDelimiter
|    ":"
| -> space
|    " "
| -> value
| | -> color
| |    "ffffff"

@dgattey
Copy link

dgattey commented Feb 25, 2019

Is this getting looked at? sass-lint relies on this AST, and as such, you can't write code with custom variables natively and run sass-lint on it. Seems like this issue has been open for 3 years, CSS variables are very much native at this point.

@jdalton
Copy link
Contributor

jdalton commented Mar 25, 2019

Hi @dgattey!

I believe initial support landed via #276 in v4.2.0.

Note: There's an open issue #290 to add support for custom properties with interpolation that I'm actively working on.

@jdalton jdalton closed this as completed Mar 25, 2019
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.

6 participants