-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Decide on SASS vs. just PostCSS + plugins #4514
Comments
So as of now I'm still sold on Sass, but:
Sass Pros:
Sass cons:
As of now my position is still let's use sass for what it's good for (maps, mixins, importing, reusable styling code) but not at the expense of future-forward css. So for example instead of just using sass variables for theming, we write a mixin that uses custom properties if supported and if not falls back on the hard-coded sass variable value. If we ever get to a point where we feel sass isn't necessary in the future, we can simply just drop the sass pass and just transpile using postcss. Also, since we're going to be including the dist'd css on a per-component basis, using the code with other build systems shouldn't be as much of an issue anymore. |
That being said, precss looks like it could be a good compromise but I still want to see the value add of that over sass. |
The popularity front is expected, Sass has far more age on it and is used in many more projects because of that.
One con of the "batteries included" part is the power it provides. It provides a bunch of functionality and we'd need to scrutinize components and all PRs making sure the output is what we expect. Otherwise it is easy to fall into over-precise selectors. If we are using PostCSS at all, I think we should go ahead and use it as our base to provide the most concise output we can. Using Sass to say, using CSS vars or fallback if not supported just creates more bloated output for us. When we could easily pre-compile down before shipping until more browsers support vars and we can just turn it on by default in the output itself. Overall, if we had a way to easily restrict what gets used in Sass and monitor the output so it wasn't a manual thing, then I'd consider staying with it more than I am now. As it is, we have the major benefits of Sass landing in CSS Standards now, such as Variables and hopefully soon Our JS-side is getting very complicated as it is. CSS has long been a pain for developers in the first place, I'd rather we keep it simple even at the expense of keystrokes (which aren't a big deal) so other contributors can more easily understand it and help out. |
Interesting point, although I feel like having using a linter mitigates a lot of that.
That's a really great point. I could definitely see the confusion and complexity increasing as our codebase grows. So I'm def coming around to using PostCSS. However I think if we do use them, we should at least start with packs rather than pick and choose our own plugins from the get-go. The reasons being:
Personally I really like the precss + cssnext combo. We can use stylelint to make sure we're not doing anything that's going to produce bad or bloated styles. |
My vote is for limiting to standards-compliant, future-forward CSS where possible. It would be advantageous to position ourselves as a "vanilla" library in as many respects as possible, especially for Polymer's sake. Given that, I would lean towards PostCSS + cssnext. |
DecisionPostCSS + CSSNext + Stylelint
|
Heya. I'm new to the library and got confused: did the move to PostCSS ever... khrm materialize? |
No it didn't. We got through parts of the conversion but realized Sass provides a huge level of maintainability benefits. So we never merged the postcss transition that was done in favor of sticking with Sass + postcss to supplement where necessary. |
@rfru @sgomes @Garbee
Let's all post our thoughts / pros + cons in comments below and then decide.
The text was updated successfully, but these errors were encountered: