npm.io
1.0.3 • Published 7 years ago

@ephox/svgroup

Licence
Apache-2.0
Version
1.0.3
Deps
0
Size
45 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

Bundler for SVG files

This project contains resources for bundling SVG files. Currently a gulp plugin is provided which can take one or more 'producers' as an option which will generate the output files from the SVGs fed to them.

Installation

svgroup is available as an npm package. You can install it via the npm package @ephox/svgroup

Install from npm

npm install @ephox/svgroup

Usage

const gulpSvgroup = require('@ephox/svgroup/gulp-svgroup');
const svgroup = require('@ephox/svgroup');
const gulp = require('gulp');

gulp.task('default', function () {
  return gulp.src('svg_sample/**/*.svg')
    .pipe(gulpSvgroup({
      producer: svgroup.providerProducer,
      options: { ... }
    }))
    .pipe(gulp.dest('dist'));
});

Existing producers and their default options

  • Provider
    {
      producer: svgroup.providerProducer,
      options: {
        filename: 'SvgProvider.ts',
        normalizeKeys: false,
        head: 'export const getAll = () => (',
        tail: ');',
        quoteType: 'single',
        quoteKeys: true,
      }
    }
    %head%{
      %filename%: %content%,
      // ...
    }%tail%
  • Enum map
    {
      producer: svgroup.enumMapProducer,
      options: {
        filename: 'SvgEnumMap.ts',
        enumName: 'Enums',
        normalizeValues: false,
        quoteType: 'single'
      }
    }
    enum %name% {
      %filename%: %filename%,
      // ...
    }
  • Preview
    {
      producer: svgroup.previewProducer,
      options: {
        filename: 'Preview.html',
        title: 'Svg Icons Preview'
      }
    }