1.2.1 • Published 2 years ago

svg-to-json-webpack-plugin v1.2.1

Weekly downloads
5
License
MIT
Repository
-
Last release
2 years ago

SVG to JSON Webpack Plugin

This webpack plugin generates a collection of SVGs in JSON format from all .svg files in a directory. This strips out the svg and title tags for manually addition when loading the SVG data. In addition to the SVG data, it also returns each SVG's title and viewbox. This code is heavily based on the SVG Spritemap Webpack Plugin by Freshheads.

NPM: svg-to-json-webpack-plugin

Installation

npm install svg-to-json-webpack-plugin --save-dev

Usage

// webpack.config.js
var SvgToJsonPlugin = require('svg-to-json-webpack-plugin');

module.exports = {
    // ...
    plugins: [
        new SvgToJsonPlugin({
            // Optional options object
        })
    ]
}

Options

OptionDefaultDescription
src'**/*.svg'glob used for finding the SVGs that should be in the spritemap
glob{}Options object for glob
prefix'sprite-'Prefix added to sprite identifier in the spritemap
filename'spritemap.json'Name for the generated file (located at the webpack output.path), [hash] and [contenthash] are supported
chunk'spritemap'Name of the generated chunk
deleteChunktrueDeletes the chunked file chunk after packing is complete

License

This project is licensed under the MIT license.

1.2.1

2 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago