You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So here's what I think about this. We want the following properties:
Don't read in blog posts unless they're actually needed
Have one single source of truth inside the gulpfile for the loading/parsing logic (stuff like frontmatter, dateInPath(), etc.)
Only run that loading/parsing logic once at runtime, even if multiple tasks require it.
Probably the best way to do this is to define a function in the gulpfile that, on first run, constructs the read stream and assigns it to a variable. On every run (including the first) the "source" stream is forked with something like pipe-iterators' fork() and returned. That way each task gets its own stream that it can mess with in whatever way it wants.
Then gulp.src() through dateInPath() can be replaced with this function, and it'll work the same (i.e. have a .pipe() method) because the function just returns a stream, just like gulp.src.
The gulpfile repeats a lot of stuff, unfortunately. I should think about ways to DRY that up.
The text was updated successfully, but these errors were encountered: