2createStudio/postcss-sprites

[Question] Prevent re-declare background-image

arianjinx opened this issue ยท 4 comments

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 ๐Ÿ˜„

Hi,

You can use something like Data Packer or Merge Rules to achieve this. ๐Ÿ˜„

Thanks @vvasilev- for those solutions although i'm not satisfied yet ๐Ÿ˜ข, 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?

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. ๐Ÿ˜„

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).