From the course: Creating Web Icons with SVG

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Display SVGs from an external sprite

Display SVGs from an external sprite

From the course: Creating Web Icons with SVG

Start my 1-month free trial

Display SVGs from an external sprite

- [Voiceover] Now that you've seen and tried out this command line tools for optimizing and generating SVG sprite, you'll never want to do it manually ever again, and you really shouldn't. This is a way more efficient method for generating SVG sprites. However, the method I showed you in the previous movie has one hitch. You noticed that I had too go into menu sprite.svg, copy out the new generated sprite. Then go into index.html and paste it in. This is really cumbersome if you have multiple pages, it becomes really hard to manage, and if you're working with a CMS like WordPress or Drupal, is not the right way to do it. Ideally, what I want to do is simply tell the browser, "Hey, there's a file over here that has an SVG sprite, "can I have the symbol with ID icon learn?" and the browser will go and grab just that symbol, and load it in. And the cool thing is we can totally do that. Now, before I show you how it's done, let me quickly remind you that this does not work if we're…

Contents