views:

35

answers:

1

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
if you're gonna override why not make the color customizable instead or just put a default color if it wasn't declared.
corroded
@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
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