David Gilbertson has recently published a very compelling article about building websites… without using CSS files! How is it possible? Does it even make sense like anytime? Well, let’s take a closer look at his case study.

Building a web app with no CSS files at all

First of all, let’s make on thing clear. David isn’t trying to say that all websites in the world should now abandon CSS files and instead define all their styles directly in JavaScript. In his article on Medium you can find out that most of the time you shouldn’t. That includes:

  • website that have their DOM written in HTML rather than using JS framework such as react.js or AngularJS
  • website that don’t require their users to interact in a way that changes DOM too much (such as Wikipedia)
  • websites… whose users don’t like taking too much risk

Advantages of not using separate CSS files for styles

So what are the actual advantages of including styles in JavaScript rather than in separate files? David lists a bunch of big wins:

  • no need to use CSS preprocessors (such LESS or SASS)
  • setting up pipeline is simpler
  • closer integration of styling with application logic
  • one language less
  • you can use style variables in JavaScript
  • ability to use images as backgroundImage

Can the way think of front end technologies change? Should it?

Of course, it’s not like everything about this approach is perfect. To learn more, I sincerely welcome you to read David’s article on Medium. It’s full of compelling case scenarios as well as grahpics and code examples and really gets its point across. Rarely do you come across articles full of such interesting and innovative ideas. It has already stirred up quite a debate and that’s great!

Most of front end web developers never questions the HTML-JS-CSS trio as a must-have technology stack for building client-side stuff. But perhaps there is a better way? Perhaps the weight of making styles should be skewered more towards programmers rather than designers? Or maybe these are designers that should get better at programming and use JS instead of preprocessors? Sure, this article doesn’t actually for a complete abandonment of CSS. But the sheer direction it’s pointing is very interesting.

What do you think? Do you find David’s thoughts just as compelling as I did?

Come back soon for even more front end trends!

 

 

Advertisements