Don’t name your mixins wrong

If you’re not using Sass, you don’t need to read this article. What you need to do is to stop writing CSS right now and learn about Sass. If you are among the anointed into the Sass community, here’s something you shouldn’t do.

Don’t name your mixin files the same as your scss. I working redoing my basic Sass structure for a Symfony application I’m building to take better advantage of the power of mixins. What I ended up with was ‘_main.scss’ and ‘main.scss.’ The import was in main.scss. Even though these two files can exist on the file system fine, my Sass compiler didn’t like it.

I use Scout. At first I noticed that Scout stopped detecting changes in my scss files. I fired up Koala to see if it would work and it logged an error that it didn’t know which file to import main.scss or _main.scss. Scout didn’t tell me that, but once I renamed _main.scss to _base.scss, Scout started working as it should.

I don’t care for Koala, but I haven’t used it much. It did help me today.

Share Button