SASS: Get value of existing background string and add to it?

老子叫甜甜 提交于 2019-12-31 05:28:08

问题


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:


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.



来源:https://stackoverflow.com/questions/10377464/sass-get-value-of-existing-background-string-and-add-to-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!