Answer the question
In order to leave comments, you need to log in
How to use svg sprites in TARS on less?
I use the tars assembly, threw the svg images into img / svg, the process has begun. The following is formed in the svg-sprites.less file:
@add-plus-hover: -4px -4px 32px 33px 40px 61px './test.svg' 'add-plus-hover';
@add-plus: -4px -41px 16px 16px 40px 61px './test.svg' 'add-plus';
.svg-sprite-position(@svg-sprite) {
@svg-sprite-offset-x: ~`"@{svg-sprite}".split(', ')[0].replace('[', '')`;
@svg-sprite-offset-y: ~`"@{svg-sprite}".split(', ')[1]`;
background-position: @svg-sprite-offset-x @svg-sprite-offset-y;
}
.bg-svg(@svg-sprite, @repeat: no-repeat) {
background-image: url('%=static=%svg-sprite/sprite.svg');
.svg-sprite-position(@svg-sprite);
width: ~`"@{svg-sprite}".split(', ')[2]`;
height: ~`"@{svg-sprite}".split(', ')[3]`;
background-repeat: @repeat;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question