I read this article today about someone who doesn’t like using preprocessors (like LESS or SASS) to compile CSS. It’s worth a read, here it is:
http://www.456bereastreet.com/archive/201603/why_i_dont_use_css_preprocessors/
I put off learning SASS for a long time, because I find it fiddly. You have to install something, and often have to run commands in a command prompt (something I hate), running gulp or grunt or whatever. But I was converted when I realised PHPStorm did it for you – which is AWESOME.
But now that I do, I feel like I can write styles so much clearer and more effectively, without getting lost in a massive page of WET CSS code. I use the word WET as the opposite of DRY (don’t repeat yourself), as without compilation your CSS can end up with lots of repetition. Especially if you need to target things inside a specific class, you might end up with this:
.main-content p, .main-content ul {} .main-content h1 {} .main-content h2 {}
Look how many times you have to type .main-content! Whereas in SASS you could write:
.main-content { p,ul {} h1 {} h2 {} }
Isn’t that cleaner?
There’s also loads of advantages – being able to split code into useful components you can paste between projects, rather than one big mass of CSS. Also, keeping colours as variables is amazing. I’ve no idea how I managed before that!
Here’s more articles about the way I like to write styles:
- How I write CSS
- Keeping CSS classes together by usage
- Don’t scrimp on classes if it means making convoluted CSS
Here’s an article to read about preprocessors: Why your reasons for no-longer using a CSS pre-processor are wrong, and you’re wrong, and you should feel bad.