S
S
SergeyKisliy2016-01-30 11:54:24
css
SergeyKisliy, 2016-01-30 11:54:24

How to make data-uri mixin in LESS?

Hello.
Can you suggest or poke your nose at the link how to make mixin in LESS to generate data-uri svg:

background-image: data-uri('image/svg+xml;charset=UTF-8', 'image.svg')

not to write it all the time, but just insert the path to the image.
I tried to do it, but there is no generation, I smell a catch that something needs to be screened. Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2016-01-30
@SergeyKisliy

.svg(@img) {
    background-image: data-uri('image/svg+xml;charset=UTF-8', @img)
}

.test {
    .svg("file.svg")
}

It turns out this code:
.test {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20baseProfile%3D%22full...");
}

I'm trying on version less 2.6.0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question