cancel
Showing results for 
Search instead for 
Did you mean: 

Idea of using cssnext instead of SASS

Idea of using cssnext instead of SASS

Paul Hachmang on Github opens an issue related to topic of cssnext syntax and other front-end related improvements in M2 - https://github.com/magento/magento2/issues/5469

 

Github issue is not a best place to discuss about future plans, even Magento guys ask to keep them only for bug reports.

 

So let me quickly respond here:

IMO cssnext is not ready to handle codebase like we have now. Lack of conditional statements, mixins, functions, loops, extends - why make a step backward? It's cool to write everything in CSS and just push this code to productions, but right now i.e. CSS variables have 63% browsers support, so at all we have to compile them to "valid" CSS.

 

"Even besides this, the whole postcss is gaining traction. A lot of plugins are available which make the whole development experience a 1000 times better. For example: The grid system in Magento 2 is limited and custom implemented, doesn't support complex grids and aren't easy to use. A postcss implementation for this is https://github.com/peterramsing/lost which is better in every way."

But this links M2 with one strict plugin / implementation of idea and might be hard to replace with other solution in future. IMO we should try to write as clean and semantic code as possible, without using this type of "language extends".

 

"var\view_preprocessed needs to go, all .less (or other uncompiled files) need to go under the static folder."
Why? Any reason?

".lib-css.. Needs to go asap. autoprefixer is here for you. It isn't 2012 anymore that we want to have vendor prefixes in our frontend files 😉"

I'm also sceptical about this mixin, but it have one more purpose rather than returning mixins - it will return nothing when variable is empty/null. That's why they wrap every variable in this mixin. Yeah, weird, that's why I already remove them from SASS version of "blank".

 

"@Media-common and @Media-target are used in combination with some guard expressions, but it seems to me that it would be easier to implement a _module.less and _module_lg.less"

IMO whole idea of building MQ based of some weird behaviour of mixins in LESS "Blank" sucks.

 

I totally agree with other points, but we should have in mind that there are also non-tech vendors (i.e. without devs) and everything should be able to work automagicaly in background - and probably that's one of the reason why we have PHP tools in front-end stack Smiley Happy