svg-sprite / grunt-svg-sprite

SVG sprites & stacks galore — Grunt plugin wrapping around svg-sprite that reads in a bunch of SVG files, optimizes them and creates SVG sprites and CSS resources in various flavours

Home Page:https://github.com/svg-sprite/svg-sprite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

change css background-position: from [%] to [px]

opened this issue · comments

Is there an option to change the output css background-position: to use Pixels instead of Percentages?
example:
(background: url("svg/sprite.css-4dbd03ed.svg") 0 62.465297057190455% no-repeat;)
change to (background: url("svg/sprite.css-4dbd03ed.svg") 0 20px no-repeat;)

@contactjoelg Moving from absolute (pixel) to relative (percent) positioning was the improvement in the latest svg-sprite generation, as it enables you to use the sprites responsively. While I consider using absolute positioning a step backwards, you should still be able to do so by writing and using a custom output template. The absolute positioning variables are still available in the templates.

As I said, there is no built-in option to switch back to absolute / pixel positioning. Go ahead and write your own customized template to do so. I provided a link to the docs in my previous comment.