ben-eb / perfectionist

Beautify CSS files.
MIT License
229 stars 14 forks source link

Which syntax(es) to support? #80

Open keithjgrant opened 7 years ago

keithjgrant commented 7 years ago

Which syntaxes should we support? Vanilla CSS and Scss?

keithjgrant commented 7 years ago

Misc thoughts/questions:

@ai suggested vanilla CSS, PreCSS, and CSS Modules

If I understand PreCSS correctly, it's very similar to SCSS. I'm not sure what sets CSS Modules syntax apart from vanilla CSS, either—doesn't it just introduce the composes property and that's it?

Is SCSS a superset of vanilla CSS? Can we get away with just supporting SCSS, and if the dev writes vanilla CSS, that's basically automatically included?

ai commented 7 years ago

PreCSS = nested CSS. So PreCSS is much more simpler than SCSS.

jeddy3 commented 7 years ago

I suggest starting with support for just standard CSS constructs.

In stylelint we do some gnarly gymnastics to identify and ignore non-standard constructs (see the isStandardSyntax* utils e.g. isStandardSyntaxRule). I don't believe ignoring constructs is an option for an automatic AST formatter because, as mentioned in prettier talk, it must get the format 100% correct.

Also, after my time on stylelint, I feel the same way as David about how non-standard syntaxes are an unnecessary obstacle to CSS tooling.

More of the stylelint team share their thoughts on non-standard syntax support in stylelint (and stylefmt) in https://github.com/stylelint/stylelint/issues/2259.

Once the standard CSS constructs are nailed, then that seems like a good time to discuss how, and if, non-standard syntaxes can/should be supported.