2

I have a bunch of SVGs that get color and parameter adaptations in Sass and then when called to be background-image. That's done using something like:

this @function(@params) dostuff..
    @return url('data:image/svg+xml;base64,'+ base64_encode($svg));

The base64_encode function is ruby but with ever growing Sass we're looking at switching to LibSass but i have so far been unable to get base64 encoding to work with LibSass. How do i get base64 encoding in LibSass?

Jørgen R
  • 10,568
  • 7
  • 42
  • 59
Sailor
  • 91
  • 5
  • If you're using the ruby implementation of LibSass, you can just continue to use the ruby function. – Jørgen R Jun 19 '15 at 10:17
  • Were using ruby sass now but the waits between editing scss and seeing results are getting frustratingly long. This is why we are considering moving to libsass, the c implementation of the sass compiler – Sailor Jun 19 '15 at 10:26
  • LibSass is just a library. Perhaps you mean SassC? In that case, use a library like [libb64](http://libb64.sourceforge.net/) – Jørgen R Jun 19 '15 at 10:32
  • 1
    I added a base64-encode() function directly to libsass as proof of concept: https://github.com/jonasjonas/libsass/commit/3a82437e267bdfc942799f0f14e1672013ba1acc – jonas_jonas Oct 21 '15 at 17:34
  • Yepp, that's more or less precisely what i ended up doing but I did it as an extra preprocessing step instead. – Sailor Oct 22 '15 at 12:25

0 Answers0