Getting Started with Myth: the Preprocessor of the Future

I strongly disagree, a preprocessor does so much more. It’s not just about changing a color value. Some examples:

  • loops help you to avoid repetitive code (i.e. if you have different areas on your site, each one in a different color/style) and make changes much easier (than being forced to replace the values multiple times)
  • true, it’s quite unlikely that you’ve used the same color for different things, but what about measures of length? As soon as you’ve got numbers, search and replace will be much harder as the same ones are used in different contexts. Furthermore search and replace will fail if different color syntax’s (#hex, rgb, rgba) are used.
  • nesting of selectors saves time (no need to repeat the long selector list all the time) and provides much better readability
  • You intrinsically avoid “magic numbers”. If you need to calculate a value, you don’t write the result, but the expression. e.g. instead of writing “12.66667em” you write something like “$parent-width - $margin-left - $margin-right”, which is some sort of documentation out of the box

When porting a huge project to SASS (design/structure remained very similar), the new sass-project had ~2.800 lines, whereas the old CSS-Project had ~12.000 lines. Of course there were some other optimizations as well, but about 60-80% of the savings was due to SASS (loops, no need for prefixes, nesting)

Have you used any Preprocessor ever intensively in a real project? I would never want to switch back again (unfortunately I’m from time to time forced to use plain old CSS again in legacy projects…and it’s a pain)!

1 Like