2createStudio / postcss-sprites

Generate sprites from stylesheets.
MIT License
413 stars 50 forks source link

[Question] Prevent re-declare background-image #49

Closed arianjinx closed 8 years ago

arianjinx commented 8 years ago

Hello, is there any way to prevent declaring background-image again and again?

.comment { background-image: url(images/sprite.png); background-position: 0 0; }
.bubble { background-image: url(images/sprite.png); background-position: 0 -50px; }

i expect just like these following lines.

.icon { background-image: url(images/sprite.png); }
.comment { background-position: 0 0; }
.bubble { background-position: 0 -50px; }

Thanks for built an amazing plugins :smile:

vvasilev- commented 8 years ago

Hi,

You can use something like Data Packer or Merge Rules to achieve this. :smile:

arianjinx commented 8 years ago

Thanks @vvasilev- for those solutions although i'm not satisfied yet :cry:, because i think defining like these following html syntax would be better.

<i class="icon comment">

Can u convince me that repeating background-image a lot considered good practices?

vvasilev- commented 8 years ago

Repeating of background-image is not a good practice but is necessary to use this plugin. The behavior that you want isn't in scope of this project so you can try to find an existing solution or create your own. :smile:

arianjinx commented 8 years ago

Again thanks @vvasilev- i'm satisfied now haha, really i'm not saying that this plugin is not good, i just need a reason to convince my team to use this plugin (for the sake of maintainability).