How to use gulp-svgstore - 7 common examples

To help you get started, we’ve selected a few gulp-svgstore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atolye15 / web-starter-kit / gulp / tasks / sprite.js View on Github external
export default function sprite() {
  return gulp
    .src(`${configs.paths.src}/icons/**/*.svg`)
    .pipe(rename({ prefix: 'icon-' }))
    .pipe(svgstore({ inlineSvg: true }))
    .pipe(
      through2.obj((file, encoding, callback) => {
        spriteStore.setSprite(file.contents.toString());
        callback(null, file);
      }),
    )
    .pipe(rename({ basename: 'sprite' }))
    .pipe(gulp.dest(`${envPath}/${configs.paths.assets.img}`))
    .on('error', errorHandler);
}
github atolye15 / web-starter-kit / gulp / tasks / images.js View on Github external
imagemin.svgo({
          plugins: [
            { removeDimensions: true },
            { removeTitle: true },
            { cleanupNumericValues: true },
            { cleanupListOfValues: true },
            { removeViewBox: false },
            { removeRasterImages: true },
            { sortAttrs: true },
            { transformsWithOnePath: true },
          ],
        }),
      ]),
    )
    .pipe(rename({ prefix: 'icon-' }))
    .pipe(svgstore({ inlineSvg: true }))
    .pipe(rename({ basename: 'sprite' }))
    .pipe(gulp.dest('.cache/img'))
    .pipe(gulp.dest(`${envPath}/${configs.paths.assets.img}`))
    .on('error', notifierErrorHandler);
}
github quentinneyraud / jekyll-starter-kit / build / gulp-tasks / build-svg.js View on Github external
'fill-rule',
              'clip-rule',
              'sketch:type',
              'sketch:type',
              'xmlns:sketch',
              'xmlns:xlink'
            ]
          }
        }
        ]
      }
    }))
    .pipe(rename((path) => {
      path.basename = 'icon-' + path.basename;
    }))
    .pipe(svgstore({
      cleanupdefs: true,
      includeTitleElement: false,
      id: 'base-icon-',
      inlineSvg: true
    }))
    .pipe(rename(config.svg_sprite_name))
    .pipe(gulp.dest(config.svg_sprite_path))
}
github kreativgebiet / kickup / tasks / markup.js View on Github external
gulp.task('sprites', () => {
  gulp.src(join(src, 'images', '**/*.svg'))
    .pipe(svgmin())
    .pipe(cheerio({
      run($) { $('[fill]').removeAttr('fill'); },
      parserOptions: { xmlMode: true },
    }))
    .pipe(svgstore({ inlineSvg: true }))
    .pipe(concat('sprites.ejs'))
    .pipe(gulp.dest(join(src, 'html', 'partials')));
});
github atolye15 / web-starter-kit / gulp / tasks / styleguide / sprite.js View on Github external
export default function sprite() {
  return gulp
    .src(`${configs.paths.src}/icons/**/*.svg`)
    .pipe(rename({ prefix: 'icon-' }))
    .pipe(svgstore({ inlineSvg: true }))
    .pipe(
      through2.obj((file, encoding, callback) => {
        spriteStore.setSprite(file.contents.toString());
        callback(null, file);
      }),
    )
    .on('error', errorHandler);
}
github ONSdigital / eq-survey-runner / gulp / images.js View on Github external
.pipe(tap((file, t) => {
      if (file.isDirectory()) {
        let name = file.relative + '.svg'
        gulp.src(file.path + '/**/*.svg')
          .pipe(svgstore({
            fileName: name,
            prefix: 'icon-',
            inlineSvg: true
          }))
          .pipe(gulp.dest(paths.svgs.output))
      }
    }))
    .pipe(svgmin())
github bannertime / generator-bannertime / src / app / templates / gulpfile.babel.js / tasks / svg-sprite.js View on Github external
gulp.task('svg-sprite', ['svg-fallback'], () => {
  return gulp.src(config.tasks.svgSprite.src)
    .pipe(imagemin())
    .pipe(svgstore())
    .on('error', handleErrors)
    .pipe(gulp.dest(config.dest))
    .pipe(browserSync.stream());
});

gulp-svgstore

Combine svg files into one with <symbol> elements

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis

Popular gulp-svgstore functions