@vkl/svg-iconset-builder

create iconset from separated svg icons

Usage no npm install needed!

<script type="module">
  import vklSvgIconsetBuilder from 'https://cdn.skypack.dev/@vkl/svg-iconset-builder';
</script>

README

@vkl/svg-iconset-builder

Plugin for creating iconsets from SVG files with customizable optimisations

Installation

Support command line interface:

npm install @vkl/svg-iconset-builder -g

Or you can install for yout project

npm install @vkl/svg-iconset-builder --save

Usage

Command line

svg-iconset --source=<source_folder|required> --result=<output_filename|required> --svgoConfig=<path to SVGO configuration json file>

Examples:

svg-iconset --source=assets/images/icons --result=icons

Creates a file icons-iconset.svg in same folder

In Project

const SvgIconset = require('svg-iconset');

const config = {
  source: 'assets/images/icons', // Reqired
  result: 'icons', // Required
  // This is optional for optimize files using SVGO plugins
  optimize: {
    removeViewBox: true, // Will remove attribute viewBox
  }
}

new SvgIconset(config).createSet();

Additional

Default SVGO optimisation config