| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import config from '../config';
- import path from 'path';
- import gulp from 'gulp';
- import plumber from 'gulp-plumber';
- import svgSprite from 'gulp-svg-sprite';
- const spriteConfig = {
- mode: {
- symbol: {
- dest: './',
- sprite: path.join(
- '../',
- config.paths.images,
- 'sprites.svg'
- )
- }
- },
- shape: {
- meta: path.join(
- config.paths.src,
- config.paths.images,
- config.paths.sprites,
- 'sprites.yaml'
- ),
- id: {
- generator: 'icon--%s'
- }
- }
- };
- /**
- * Compile svg sprites into single svg file
- *
- * @param cb: callback handler passed by gulp, signals task completion when called
- */
- export const sprites = (cb) => {
- gulp.src(
- path.join(
- config.paths.src,
- config.paths.images,
- config.paths.sprites,
- '*.svg'
- ))
- .pipe(plumber())
- .pipe(svgSprite(spriteConfig))
- .pipe(gulp.dest(
- path.join(
- config.paths.dest,
- config.paths.assets,
- config.paths.images
- )
- ));
- cb();
- };
|