Reopen SASS Mixins

2019-07-26 00:20发布

问题:

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 ?

回答1:

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.