Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hughsk/svgify
A browserify transform for requiring SVG files to embed directly in your code.
https://github.com/hughsk/svgify
Last synced: 15 days ago
JSON representation
A browserify transform for requiring SVG files to embed directly in your code.
- Host: GitHub
- URL: https://github.com/hughsk/svgify
- Owner: hughsk
- License: other
- Created: 2013-07-15T10:02:23.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-07-15T10:02:31.000Z (over 11 years ago)
- Last Synced: 2024-10-17T16:41:01.895Z (25 days ago)
- Language: JavaScript
- Size: 102 KB
- Stars: 7
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# svgify #
A [browserify](http://browserify.org/) transform for requiring SVG files to
embed directly in your code.The intention is to be able to quickly inline files saved from Illustrator -
it's still a bit rough around the edges, but should improve over time.## Installation ##
``` bash
npm install svgify
```## Usage ##
### `createElement = require('./file.svg')` ###
Returns a function that will create a new SVG `` element containing the
contents of the SVG file supplied.### `createElement([xOffset[, yOffset]])` ###
Call the function and you'll get an element in return - optionally, you can
pass x/y transform variables to offset the contents of the group.``` javascript
var circle = require('./circle.svg')
var svg = document.createElement('svg')// Assuming the circle is 64x64,
// this makes the center of the circle
// the origin.
var el = circle(-32, -32)svg.appendChild(circle)
document.body.appendChild(svg)
```