Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/petercollingridge/svg-optimiser.js

An online SVG optimiser using Javascript and jQuery
https://github.com/petercollingridge/svg-optimiser.js

Last synced: 10 days ago
JSON representation

An online SVG optimiser using Javascript and jQuery

Awesome Lists containing this project

README

        

SVG-optimiser.js
================

An online SVG optimiser using Javascript and jQuery

##Using optimise-functions.js and SVG-elements.js

###Create an SVG_Root object
The `SVG_Root` object is what parses the SVG and allows you to access the optimisation functions. You can pass it either a complete SVG or an SVG element (which can have child elements).

You can pass it a string with:
`var SVGObject = SVG_Root('');`

Or a JQuery object with:
`var SVGObject = SVG_Root($('#my-svg'));`

###Optimise the SVG
Optimisation is done with: `svg.optimise();`

There are many options which I will have to write about at some point.

###Write the SVG
You can get the SVG as a string with:
`SVGObject.write();`

Or as a DOM element with:
`SVGObject.createSVGObject();`