An open API service indexing awesome lists of open source software.

https://github.com/viktorlarsson/gulp-inject-svg

This gulp plugin will check all img tags with an external svg and replace the tag with inline svg.
https://github.com/viktorlarsson/gulp-inject-svg

gulp inline svg

Last synced: 10 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# gulp-inject-svg

[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)

## Information

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

[![NPM](https://nodei.co/npm/gulp-inject-svg.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/gulp-inject-svg/)

## 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




```