0.1.3 • Published 7 years ago

gulp-svg2string-set-var v0.1.3

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

gulp-svg2string Dependency Status

Convert SVG file to JavaScript string.

Install

$ npm install --save-dev gulp-svg2string

Usage

var gulp = require('gulp');
var svgstore = require('gulp-svgstore');
var svg2string = require('gulp-svg2string');

gulp.task('default', function () {
  return gulp.src('src/**/*.svg')
    .pipe(svgstore({ inlineSvg: true }))
    .pipe(svg2string())
    .pipe(gulp.dest('dest'));
});
<!doctype html>
<html lang="en">
  <head>
    <script src="sprite.js"></script>
  </head>
  <body>
    <!-- SVG sprite include -->
    <div class="svg-placeholder"
      style="border: 0; clip: rect(0 0 0 0); height: 1px;
        margin: -1px; overflow: hidden; padding: 0;
        position: absolute; width: 1px;"></div>
    <script>
      document.querySelector('.svg-placeholder').innerHTML = SVG_SPRITE;
    </script>
    <!-- end SVG sprite include -->

    <svg xmlns="http://www.w3.org/2000/svg">
      <use xlink:href="#icon"></use>
    </svg>
  </body>
</html>

License

MIT © Timofey Dergachev

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago