-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a proposal to make room for plain-CSS functions and mixins
See #3787
- Loading branch information
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Preparing for Plain CSS Functions and Mixins: Draft 1 | ||
|
||
*([Issue](https://github.com/sass/sass/issues/3787))* | ||
|
||
This proposal adds errors for existing Sass syntax which is likely to conflict | ||
with upcoming plain CSS support for functions and mixins. | ||
|
||
## Table of Contents | ||
|
||
* [Background](#background) | ||
* [Summary](#summary) | ||
* [Semantics](#semantics) | ||
* [`@mixin`](#mixin) | ||
* [`@function`](#function) | ||
* [Deprecation Process](#deprecation-process) | ||
|
||
## Background | ||
|
||
> This section is non-normative. | ||
In [this informal proposal] and [this issue], the CSS working group have begun | ||
seriously discussing the possibility of introducing functions and mixins to CSS | ||
itself. Although many specific details are still in flux, all syntaxes that have | ||
been floated have two things in common: | ||
|
||
[this informal proposal]: https://css.oddbird.net/sasslike/mixins-functions/ | ||
[this issue]: https://github.com/w3c/csswg-drafts/issues/9350 | ||
|
||
* They use at-rules named `@mixin` and `@function`, just as Sass does today. | ||
* They require custom identifiers beginning with `--` after these at-rules. | ||
|
||
Sass currently allows functions and mixins whose names begin with `--`, but this | ||
is a relatively painless thing to deprecate and would allow us full CSS | ||
compatibility with whatever version of the proposal ends up getting implemented. | ||
|
||
## Summary | ||
|
||
> This section is non-normative. | ||
This proposal makes any mixin or function whose name begins with `--` an error. | ||
This will be preceded by a deprecation period in which those mixins and | ||
functions will just produce warnings. | ||
|
||
## Semantics | ||
|
||
### `@mixin` | ||
|
||
Update [the `@mixin` semantics] to add after the first line: | ||
|
||
[the `@mixin` semantics]: ../spec/at-rules/mixin.md | ||
|
||
* If `name` begins with `--`, throw an error. | ||
|
||
### `@function` | ||
|
||
Update [the `@function` semantics] to add after the first line: | ||
|
||
[the `@function` semantics]: ../spec/at-rules/function.md | ||
|
||
* If `name` begins with `--`, throw an error. | ||
|
||
## Deprecation Process | ||
|
||
During the deprecation period, instead of throwing errors as described in [the | ||
semantics section] above, emit a deprecation warning named `css-function-mixin`. | ||
|
||
[the semantics section]: #semantics |