Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shakyshane/svg-sprite-data
https://github.com/shakyshane/svg-sprite-data
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/shakyshane/svg-sprite-data
- Owner: shakyShane
- License: mit
- Created: 2014-07-18T21:14:11.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-12-11T16:16:33.000Z (about 6 years ago)
- Last Synced: 2024-10-31T17:58:22.393Z (2 months ago)
- Language: JavaScript
- Size: 44.9 KB
- Stars: 3
- Watchers: 4
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
svg-sprite-data
===============An attempt to make the [svg-sprite](https://github.com/jkphl/svg-sprite) lib work on strings only which
will allow everyone to create their own awesome libs on top of it.The idea is to remove ALL file-system access and leave all that to the authors who create tools on top of this. So, this
module only has a couple of methods, only accepts strings & only returns data - it never touches anything on the file-system.##Usage
```js
var SpriteData = require("svg-sprite-data");
var fs = require("fs");var config = {
common: "icon",
dims: true,
layout: "diagonal",
render: {
css: true
}
};// Create instance
var spriter = new SpriteData(config);// Read a file however you like
var path = "./test/fixtures/fb.svg";
var svg = fs.readFileSync(path, "utf-8");// Add the files CONTENTS only.
spriter.add(path, svg).compile(function (err, svg) {// Do crazy-ass shit with templates etc
console.log(svg);});
```