Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/petercollingridge/svg-optimiser.js
- Owner: petercollingridge
- License: mit
- Created: 2014-06-14T16:37:20.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-08-15T20:30:59.000Z (over 3 years ago)
- Last Synced: 2024-12-16T12:14:15.330Z (24 days ago)
- Language: JavaScript
- Size: 80.1 KB
- Stars: 51
- Watchers: 9
- Forks: 13
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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();`