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 Type Functions #1937

Closed
whaaaley opened this issue Dec 14, 2015 · 1 comment
Closed

CSS Type Functions #1937

whaaaley opened this issue Dec 14, 2015 · 1 comment

Comments

@whaaaley
Copy link

Such as:

type-property() // margin, padding, etc.
type-flag() // !important
type-length() // px, em, rem, etc.
type-unit() // %, vw, vh, etc. as well as lengths
type-style() // solid, dashed, dotted, etc.

Each returning true or false or have a function similar to type-of but specifically for these types. type-of seems to be specific to how Sass works, but having functions for types specific to CSS I think would be useful too, even though they may not necessarily be traditional types.

  • Error checking would be easier, especially for mixin arguments that require these types.
  • It would make comma-less mixin arguments easier to make, which would be even cooler to have with the new +mixin syntax. (have a mixin accepting a list of values and determining what they are later)
  • Unit conversions could be made easier.

I don't think this is a feature anyone is in dire need of, but it would be pretty useful for people who like to make super fancy mixins to generate CSS and I think it makes sense for Sass to have CSS specific "types" as well as Sass specific types.

@chriseppstein
Copy link

This requires Sass to have intimate knowledge of the current state of all CSS specifications and requires constant updates to Sass in order to maintain correctness. This is contrary to Sass's goal of being as future-proof as possible.

This is a great idea for a Sass library which can be updated and released on a much more frequent basis than the language itself.

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