I want to put my spellcheck results out to the console instead of to a file and I think this should work since as I understand it gulp returns a stream.
Instead I get an error:
TypeError: Object #<Stream> has no method 'read'
Here is my code
gulp.task('spellcheck', function() {
var patterns = [{
// Strip tags from HTML
pattern: /(<([^>]+)>)/ig,
replacement: ''
}];
var spellSuggestions = [{
pattern: / [^ ]+? \(suggestions:[A-z, ']+\)/g,
replacement: function(match) {
return '<<<' + match + '>>>';
}
}];
var nonSuggestions = [{
pattern: /<<<.+>>>|([^\s]+[^<]+)/g,
replacement: function(match) {
if (match.indexOf('<') == 0) {
return '\n' + match + '\n';
}
return '';
}
}];
var toConsole = gulp.src('./_site/**/*.html')
.pipe(frep(patterns))
.pipe(spellcheck())
.pipe(frep((spellSuggestions)))
.pipe(frep((nonSuggestions)));
var b = toConsole.read();
console.log(b);
});