How can I use variable in SASS extend?
I am trying to convert the following mixing to extend for example:
4 Replies
Oh I haven't seen
.sass
syntax in a long time!
You could convert it to an extend if you want, but you wouldn't be able to have the $lineNumbers
argument. One advantage of mixins over extends is that they accept arguments.
What you could do, if you're really trying to optimize the code, is create an extend for what can be extended, and include that in the mixin...
At the end of the day, once things have been gzipped by the server, you probably won't actually gain anything by doing this though.@Kevin Thanks Kevin, I tried using variables but thought I could not write it properly (syntax error). Thanks for clarifying its not possible within extend. I've created extend as you've suggested and using it like this, all good. Thanks again!
PS: I'm big fan of SASS over SCSS as I'm lazy 👀
I started with it and loved it too, but switched because I write CSS more than 50% of the time, and I'd keep forgetting semi-colons and it drove me crazy, lol
That's a good thing specially for your students who only know CSS 🙂
But for personal use, SASS is sweet!
No semi-colon, brackets, clean codes & specially changing nesting is so fast