0.0.2 • Published 8 years ago
gulp-imgdown v0.0.2
gulp-imgdown
Info
when write blog in markdown, you may use external image in you post, this gulp plugin helps you to download image start with http(s) and save it locally.
Params
fpath
: this path to save file local, image file name will use formatmd5(src) + ext
upath
: this path used to replace the origin image src in html file generated by .md file. the complete path will beupath + name
be careful with these parms, it may affect you html from showing the image correctly.
Usage
var gulp = require('gulp');
var markdown = require('gulp-markdown');
var imgdown = require('gulp-imgdown');
var path = require('path');
var base = __dirname;
gulp.task('markdown', function() {
return gulp.src('src/article/*.md')
.pipe(markdown())
.pipe(imgdown({
upath: '/images/a/',
fpath: path.join(base, '/images/a/')
}))
.pipe(gulp.dest(function(f) {
return f.base;
}));
});
gulp.task('default', function() {
gulp.watch('src/article/*.md', ['markdown']);
});