Hi, Is there a way to redefine SASS mixins. I want to override SASS mixins for site specific styling needs. Is there a way to do it ?
+2
A:
My quick bit of testing seems to show that you can override mixins without a second thought. You can't reopen them to the extent that would allow you to override only certain attributes, but you can easily replace them entirely.
sample.sass:
=test
color: red
font-weight: bold
=test
color: blue
p
+test
sample.css:
p {
color: blue; }
Note that this test was performed using Haml/Sass 3.0.2 (Classy Cassidy), so this may not hold true for earlier versions, if you were getting an error before.
Matchu
2010-05-31 13:37:24
if you're gonna override why not make the color customizable instead or just put a default color if it wasn't declared.
corroded
2010-05-31 13:52:51
@corroded - This is just a demo of overriding, which the OP asked about. It's not meant to be an example of good code. But thanks for making sure that newbies don't think otherwise :)
Matchu
2010-05-31 13:57:05
yup just also suggesting to the OP that there's no need to override if you can just use the mixins as functions that can take in variables :) no offense meant :)
corroded
2010-05-31 14:13:39