gulp-rsvg
![Dependency Status](https://camo.githubusercontent.com/37d96d1c7ff23b4b8e44c2d60f3de0d866877fd58a9dfe715ce1feb3c2984c3f/68747470733a2f2f67656d6e617369756d2e636f6d2f62656e2d65622f67756c702d727376672e737667)
Convert SVG to PNG or PDF.
If you have any difficulties with the output of this plugin, please use the RSVG tracker.
With npm do:
npm install gulp-rsvg --save-dev
Note that this plugin wraps node-rsvg and so requires LibRSVG to be available on the command line. Please see the README for node-rsvg for a guide on how to set that up for your platform.
var gulp = require('gulp');
var convert = require('gulp-rsvg');
gulp.task('png', function () {
return gulp.src('logo.svg')
.pipe(convert())
.pipe(gulp.dest('./out'));
});
gulp.task('pdf', function () {
return gulp.src('logo.svg')
.pipe(convert({
format: 'pdf'
}))
.pipe(gulp.dest('./out'));
});
Type: String
Default value: png
The format to convert to. Accepts png
or pdf
.
Type: Integer
Default value: undefined
Specify a new width for the resulting file. Defaults to the width of the SVG.
Type: Integer
Default value: undefined
Specify a new height for the resulting file. Defaults to the height of the SVG.
Type: Integer
Default value: 1
Scale the generated file by this factor. Useful for retina assets.
Type: Function
Default value: require('librsvg').Rsvg
Pass a svg rendering library. Rsvg
by npm package librsvg
used by default.
Pull requests are welcome. If you add functionality, then please add unit tests to cover it.
MIT © Ben Briggs