gulp-markrun
v0.1.0
Published
markrun
Downloads
2
Readme
gulp-markrun
建议自己封装 gulp 插件 ,这样能更加灵活的使用 markrun
var gutil = require('gulp-util')
var markrun = require('markrun')
var through = require('through2')
function markrunCompile () {
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
this.push(file)
return cb()
}
if (file.isStream()) {
this.emit('error', new gutil.PluginError('markrun', 'Streaming not supported'))
return cb()
}
var content = file.contents.toString()
content = markrun(content)
file.path = gutil.replaceExtension(file.path, '.html');
file.contents = new Buffer(content);
this.push(file)
cb()
})
}
gulp.src(src)
.pipe(markrunCompile())
.pipe(gulp.dest(dest))