gulp-rsvg v1.0.2
gulp-rsvg
Convert SVG to PNG or PDF.
If you have any difficulties with the output of this plugin, please use the RSVG tracker.
Install
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.
Example
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'));
});
API
format
Type: String
Default value: png
The format to convert to. Accepts png
or pdf
.
width
Type: Integer
Default value: undefined
Specify a new width for the resulting file. Defaults to the width of the SVG.
height
Type: Integer
Default value: undefined
Specify a new height for the resulting file. Defaults to the height of the SVG.
scale
Type: Integer
Default value: 1
Scale the generated file by this factor. Useful for retina assets.
Rsvg
Type: Function
Default value: require('librsvg').Rsvg
Pass a svg rendering library. Rsvg
by npm package librsvg
used by default.
Contributing
Pull requests are welcome. If you add functionality, then please add unit tests to cover it.
License
MIT © Ben Briggs
7 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago