SASS: Get value of existing background string and

2019-03-06 11:06发布

I'd like to additively build backgrounds in SASS/Compass, ignorant of the existing background string. I am able to accomplish by writing to a global var, but it seems sloppy.

Pseudo:

=mixin-add-icon
  // add a background icon
=mixin-add-gradient-from-color($color: blue !default)
  // add a background gradient
=mixin-add-texture-bg
  // add a bg texture

a
  background: blue
  +mixin-add-texture-bg
     // this should take the existing bg and add texture to it
  &.selected
    +mixin-add-gradient-from-color()
    +mixin-add-icon
       // these two should take the existing bgs strings from <a> and add to them

Am I missing something obvious? Thanks in advance.

1条回答
Summer. ? 凉城
2楼-- · 2019-03-06 11:43

There isn't currently a way to access an object's properties via Sass, but Sass is an open project so you can always go and ask the developpers if such a feature would be possible on their Github repo.

查看更多
登录 后发表回答