@noname-land/svg-sprite-data
Create SVG sprite data only
Last updated 8 months ago by igoradamenko .
Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @noname-land/svg-sprite-data 
SYNC missed versions from official npm registry.

@noname-land/svg-sprite-data

Note: The project is a fork of the same called package svg-sprite-data! It was created because the original one was abandoned for a long time, but there's a possibility that the author of that project has already returned and continued to support it. So go and check the status of that project first.

An attempt to make the 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

const SpriteData = require('svg-sprite-data');
const fs  = require('fs');

const config = {
  common: 'icon',
  dims: true,
  layout: 'diagonal',
  render: {
    css: true
  }
};

// Create instance
const spriter = new SpriteData(config);

// Read a file however you like
const path = './test/fixtures/fb.svg';
const 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);
});

Current Tags

  • 0.1.1                                ...           latest (8 months ago)

2 Versions

  • 0.1.1                                ...           8 months ago
  • 0.1.0                                ...           8 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |