更新时间:2023-12-05 13:07:58
流中没有读取方法。您有两种选择:
There is no read method on a stream. You have have two choices:
Implemented in code:
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 '\n' + match +'\n';
}
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 = '\n\n' + Array(bufLength).join("_") + '\n\n'
if (contents.length > 1) {
process.stdout.write(chunk.path + '\n' + contents + '\n');
process.stdout.write(chunk.path + hr);
}
});
});