更新时间:2023-12-05 13:16:52
流上没有读取方法.你有两个选择:
There is no read method on a stream. You have have two choices:
在代码中实现:
gulp.task('spellcheck', function () {
var patterns = [
{
// Strip tags from HTML
pattern: /(<([^>]+)>)/ig,
replacement: ''
}];
var nonSuggestions = [
{
pattern: /<<<.+>>>|([^s]+[^<]+)/g,
replacement: function(match) {
if (match.indexOf('<')==0) {
return '
' + match +'
';
}
return '';
}
}];
var a = gulp.src('./_site/**/*.html')
.pipe(frep(patterns))
.pipe(spellcheck(({replacement: '<<<%s (suggestions: %s)>>>'})))
.pipe(frep(nonSuggestions))
;
a.on('data', function(chunk) {
var contents = chunk.contents.toString().trim();
var bufLength = process.stdout.columns;
var hr = '
' + Array(bufLength).join("_") + '
'
if (contents.length > 1) {
process.stdout.write(chunk.path + '
' + contents + '
');
process.stdout.write(chunk.path + hr);
}
});
});