Book Image

Mastering SVG

By : Rob Larsen
Book Image

Mastering SVG

By: Rob Larsen

Overview of this book

SVG is the most powerful image format in use on the web. In addition to producing resolution-independent images for today's multi-device world, SVG allows you to create animations and visualizations to add to your sites and applications. The simplicity of cross-platform markup, mixed with familiar modern web languages, such as CSS and JavaScript, creates a winning combination for designers and developers alike. In this book, you will learn how to author an SVG document using common SVG features, such as elements and attributes, and serve SVG on the web using simple configuration tips for common web servers. You will also use SVG elements and images in HTML documents. Further, you will use SVG images for a variety of common tasks, such as manipulating SVG elements, adding animations using CSS, mastering the basic JavaScript SVG (API) using Document Object Model (DOM) methods, and interfacing SVG with common libraries and frameworks, such as React, jQuery, and Angular. You will then build an understanding of the Snap.svg and SVG.js APIs, along with the basics of D3, and take a look at how to implement interesting visualizations using the library. By the end of the book, you will have mastered creating animations with SVG.
Table of Contents (17 chapters)
Title Page
PacktPub.com
Contributors
Preface
Index

Chapter 11. Tools to Optimize Your SVG

Now that you've learned all about SVG in this book — everything from the basics of pure SVG markup to the dynamic, JavaScript-based SVG work you've done over the past few chapters — you're ready to take advantage of everything that SVG offers. 

One final aspect of SVG that we should look at is how to make sure the work you do is presented in the best possible way when you serve it to your users. SVG should be optimized for performance, both in terms of performance over the wire and in terms of complexity.  Keeping your SVG files as lean as they can be and serving them efficiently is going to make for a much better experience for your users.

This chapter will serve as a high-level introduction to the many ways that you can optimize your SVG images. Some of what follows is pure, performance-related engineering. Others are pure SVG tooling. 

In this chapter, you'll learn about the following:

  • Compressing SVG on the server in three popular server platforms ...