gulp-inject-svg

replaces external svg with inline svg

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
gulp-inject-svg
1970.1.186 years ago9 years agoMinified + gzip package size for gulp-inject-svg in KB

Readme

gulp-inject-svg
experimental

Information

This gulp plugin will check all img tags with an external svg and replace the tag with inline svg. NPM

Usage

```html
```

Note

You either need to use an absolute path relative to your project root /src/assets/img/icons/exclamation_mark.svg or pass a configuration object to the plugin injectSvg({ base: '/src' })

Ignore some SVG files

You can prevent some SVG files from inject by the attribute data-skip-inject-svg ```html ```

Example

```javascript var gulp = require('gulp'); var injectSvg = require('gulp-inject-svg'); var injectSvgOptions = { base: '/src' }; gulp.task('injectSvg', function() { return gulp.src('/src//.html')
.pipe(injectSvg(injectSvgOptions))
.pipe(gulp.dest('public/'));
}); ``` Replaces your <img> tags with the corresponding inlined svg file. ```html
```