@noname-land/svg-sprite-data

0.1.1 • Public • Published

@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);
});

/@noname-land/svg-sprite-data/

    Package Sidebar

    Install

    npm i @noname-land/svg-sprite-data

    Weekly Downloads

    3

    Version

    0.1.1

    License

    none

    Unpacked Size

    33.9 kB

    Total Files

    7

    Last publish

    Collaborators

    • igoradamenko