svg2css

0.0.8 • Public • Published

svg2css

Read SVGs from a directory, creates sprites of each svg with color variations specified in a separated JSON file, and generates a simple CSS file.

Installation

Install the module with npm:

npm install svg2css

Configuration

  • dataUris Type: Boolean. Default: false

    Generate CSS file with base64 SVGs as data URIs

  • spriteCellWidth Type: Number. Default: 520

    The width of each sprite cell

  • spriteCellHeight Type: Number. Default: 520

    The height of each sprite cell

  • svgPath Type: String. Default: 'svg/'

    Input folder of SVGs

  • outputPath Type: Sring Default: 'output/'

    Output folder for SVGs

  • cssPath Type: String. Default: 'output/svg'

    Path for the generated stylesheet

  • colorFile Type: String. Default: 'colors.js' Path to the JSON file where read the color information for color conversion. The path is relative to svgPath.

Usage

var svg2css = new SVG2CSS({
    svgPath: 'example/svg/',
    outputPath: 'example/output/',
    cssPath: 'example/output/css/',
    colorFile: 'colors.json' // relative to svgPath
});

See example/run.js for more info.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i svg2css

Weekly Downloads

0

Version

0.0.8

License

MIT

Last publish

Collaborators

  • vieron