12
kiki
3y

I hate Sass.

When installing all NPM dependencies with npm i, it's always quick, but not with sass. Ooooh myy goood. It starts compiling. It always misses something. Your node version is always not what sass needs. It pulls out gyp which requires some native shit. The build is never reproducible, it always fails with some horrible two mile long poorly-formatted stacktrace that is just gibberish.

More than that, sass is just poorly designed tool used by frontend fuckboys to write imperative, nonstandard, non-maintainable styles. If you know shit about css, you don't need sass.

I'm so happy it's going to die along with gulp. Webpack and css modules are here.

Yes, css-in-js that has a runtime penalty is also shit. If you like its syntax but dislike everything else, use Linaria. It has no runtime penalty and looks just like other css-in-js solutions.

Comments
  • 2
    If only Linaria wasn't React-only. As far as I can tell, it doesn't support anything else.

    Otherwise, yes I prefer CSS-In-JS because I can dynamically update styles using S.js signals (I use Surplus, not React).

    Webpack is also shit, though. Slow, bloated and the ecosystem encourages non-standard things such as importing weird filetypes (e.g. css or images) into javascript.

    There are much better ways of packaging. The problem is, most of them are terrible right now (e.g. just tried snowpack and I'll never touch it again - I'm working to remove it entirely from the one project I've tried it on).
  • 1
    I liked sassc
  • 2
    My only gripe about css in js is that it just bloats the whole file, and if you’re using react it’s already bloated looking to begin with. As a rule of thumb I try to keep each file 150 lines or less, and that’s damn near impossible with css in js.
  • 0
    @wackOverflow CSS-In-JS generally separates the CSS bits and the component bits. The upside is that the entire file contains everything necessary to render the component, and usually the sections are so visually distinct that they don't collectively create a bloated mess.

    Note that this is for when you use a CSS-in-JS framework like JSS, NOT when you use the style property directly on elements - in which case, I agree with you.
  • 1
    @junon if it can be written in a style sheet then put it in its own file. React/Jsx feels like it’s devolved into early html with defining css classes inside the component they way someone writing html can put a <style> tag in the head of the doc. I’d rather read 3 separate small files than spank control + f all day trying to find what I need.
  • 1
    On the other hand, CSS modules are hard to maintain because they turn your class names into grabled mess. There has to be a better way on large scale using global styling.

    Less is a good choice in my opinion for writing large scale global styles because, unlike scss and sass, it just works and you can write hierarchies to aid against collisions.

    The other way is of course web components because you then have shadow dom. Trouble is, they are simply annoying to create.
  • 0
    Anyone here using https://caniuse.com/css-variables ?
    Looks like they are widely supported now.
  • 0
    @theuser

    > On the other hand, CSS modules are hard to maintain because they turn your class names into grabled mess.

    Not JSS.
  • 0
    @junon how come linaria is react-only? You write plain css, linaria outputs a class name string, you put it into class attribute value and that’s it. That’s framework-agnostic, works even with plain html afaik
  • 0
    @kiki The documentation only mentions React and compatibility with CRA - maybe I didn't read enough. I'll look at it again.

    If it can replace jss 1:1 with only an extra build step, then I'm all in.
  • 1
    @junon There are linaria loaders for webpack, just a matter of running it before babel-loader for js or ts. CRA is just a premade webpack config.

    With that being said, I am 100% behind separation, so CSS in js is not my cup of tea
  • 0
    @theuser I use none of those things. That's my issue.

    I don't use Webpack because it's bloated and slow. I don't use React because it's bloated and slow. I don't use CRA because it's React, and also because it's bloated and slow.

    As for separation, that means separate files, so that means you have to look in multiple places to understand a single component, which is an absolute deal-breaker for me - and should be for anyone else, too, in my opinion.
  • 0
    @Oktokolo Yeah I started using them 1 year ago on all new projects and some old projects that don't need IE support, they work really well
  • 0
    Sass isn’t going anywhere... for a long time...
Add Comment