@rfru @sgomes @Garbee
Let's all post our thoughts / pros + cons in comments below and then decide.
Prior PostCSS trial: #3420
So as of now I'm still sold on Sass, but:
Sass Pros:
@import. We can easily split up our code into logical modules, and it's integrated directly into the language.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.
@import has a module for that which we'd take advantage of to make sharing the global variables easier. That is the only module we'd use that isn't something browsers can do directly down the road.
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 @apply will be on a standards track. Writing plain CSS and transpiling back to support more browsers while the new stuff isn't out yet seems like a much better strategy for maintainability then trying to marry Sass and PostCSS together and create an even more confusing codebase for contributors.
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.
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.
Interesting point, although I feel like having using a linter mitigates a lot of that.
Writing plain CSS and transpiling back to support more browsers while the new stuff isn't out yet seems like a much better strategy for maintainability then trying to marry Sass and PostCSS together and create an even more confusing codebase for contributors.
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.
PostCSS + CSSNext + Stylelint
Heya. I'm new to the library and got confused: did the move to PostCSS ever... khrm materialize? package.json still says gulp-sass.
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.
Most helpful comment
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.