Is it a good idea to insert inline SVG files?

5

I've been stalling on websites and those who use SVG logos often put them in a file separately. This brings up the convenience of when you change the file, on all pages it changes, but you make one more request.

Is it a good idea instead of calling the image, inserting it directly into HTML? Regarding the practicality I mentioned above, it could easily be bypassed with a file called logotipo-svg.php (or logotipo-svg.html ) that would generate the SVG inline code ready to be inserted into the page through a:

echo '<div class="logotipo">' . file_get_contents('logotipo-svg.php') . '</div>';

Is it too much work to reduce the data transferred? Is the amount of data to be transferred reduced?

    
asked by anonymous 14.06.2015 / 00:56

1 answer

5

Cases where strongly DO NOT perform well

  • The site already uses a sprite, where many small images are loaded at once
  • The logo is a text font (similar to what happens with sprite
  • Your image is great
  • Cases where this tends to be interesting

  • Your image is small. (maybe 1 ~ 3kb), any kind of image.
  • Size not too large (maybe 10 ~ 50kb?), if the image does not repeat on more pages, and not SVG (JPEG, PNG and inline GIF in base64 greatly increase the size)
  • Any size, if the image does not repeat on more pages and for SVG (SVG compression inside and outside of HTML will be equivalent)
  • * Case study: Website link , single page, includes image in HTML with <img src="data:..

    14.06.2015 / 10:03