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
From the course: Creating Web Icons with SVG
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Overview of the method1m 22s
-
(Locked)
Create a manual SVG sprite3m 56s
-
(Locked)
Display SVGs from an inline sprite3m 29s
-
(Locked)
Create an optimized SVG sprite with SVGO and spritesh7m 14s
-
(Locked)
Display SVGs from an external sprite2m 49s
-
(Locked)
Patch browser support issues4m 28s
-
(Locked)
-
-
-