-
Notifications
You must be signed in to change notification settings - Fork 676
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
Define guidelines for preprocessors, libraries, frameworks #7150
Comments
Anecdotal evidence of why this would be helpful.
The nesting spec plugin was updated to be spec compliant and we have received many reports and questions about this. It would have been better if a different character was used by us until the spec was more mature : .foo {
color: blue;
🪆:hover {
color: red;
}
} We could have maintained this indefinitely and no one would have had to do any migrations. We also started shipping experimental versions of plugins which solves an internal problem. But we could have done a bit better here. .foo:csstools-has(> .bar) {
color: red;
} We are currently working on a new feature which only makes sense in a preprocessor : csstools/postcss-plugins#304 This itself is a bandaid for non-standard things conflicting with standard features. |
Another example of a library clashing with a native feature : #7676 (comment) This could have been avoided with a jquery specific prefix. |
More on nesting : Because we implemented the specced behaviour without any prefix as a PostCSS plugin we made it impossible to gather unbiased feedback about alternatives from stylesheet authors. |
Because this keeps happening I am reopening this issue. I personally would welcome this because I am not an expert on this either and I might be producing future conflicts unknowingly. |
Another example : A PostCSS plugin for When checking the plugin for spec compliance I found at least two points that require clarification : |
Why not use vendor prefixes? |
For new PostCSS plugins I have indeed adopted a
This is not a popular choice and the first thing users do is open an issue requesting us to drop this prefix. But it is the right thing to do for the ecosystem. I think the CSS WG is best suited to create general guidelines because it has the most reach and the best insights into these types of issues. If I create guidelines for the csstools org it only solves issues we create where I would like to see a more general solution. These guidelines might be little more than : "you must adopt vendor prefixes when inventing features" |
A vendor prefix guideline does not help for syntactical things like custom units : https://github.com/csstools/custom-units .my-component {
font-size: 24--rpx;
padding-inline: 3--step;
} |
Guidelines already exist for polyfills : https://www.w3.org/2001/tag/doc/polyfills/
A similar document with considerations and suggestions could be created for CSS preprocessors, libraries, frameworks.
(Any tool can choose to adopt these or not)
The goal of this document would be to prevent conflicts between future CSS features and non-standard things in developer tools.
if this already exists please let me know, I couldn't find it
"preprocessors, libraries, frameworks" will be referred to as "tools".
In tools it is preferable not to invent new syntax as they are not used in a vacuum.
Developers also use linters, static analysis and need IDE features (syntax highlighting, auto complete, ...).
Using existing syntax/grammar with custom keywords makes it much easier to roll out a new feature in one tool, without requiring the whole ecosystem to adapt.
tools can move at a much faster pace than the CSS spec and browsers.
The most obvious name for a feature is often the best name. (and multiple distinct features can all have the same best name)
there is no working group for tooling (that I know of)
These factors make it absolutely certain that conflicts will keep on happening without proper guidelines.
Conflicts are not only a burden on the creators and users of preprocessors when tools and source code need to be updated.
Users might have years of experience and knowledge associated with how a certain keyword works.
This is an issue today with PostCSS plugins transforming nested CSS.
Users expect
&
to behave in a certain way based on experience with Sass and see the specced feature as bugged.Whereas avoiding conflicts will allow developers to freely mix tooling features and native features.
Note :
It is not my intention to have a document that defines how tools must work or what they can or can not implement.
Only to have a safe framework to let tools grow together with native CSS features.
The text was updated successfully, but these errors were encountered: