-
-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Capture file buffer post render / pre save #940
Comments
@DigitalKrony Thanks for the issue! If you're reporting a bug, please be sure to include:
If your issue is related to one of the following, please open an issue there:
|
Indeed you can! try using a app.postRender(/\.hbs$/, function(file, next) {
// do stuff with file
next(null, file);
}); Or, if you only want to do this in a single task or pipeline, use a plugin: app.task('default', function() {
return app.src('*.hbs')
.pipe(app.renderFile())
.pipe(through.obj(function(file, enc, next) {
// do stuff with file
next(null, file);
}))
.pipe(app.dest('some_folder'));
}); |
you can also use app.preWrite(/\.hbs$/, function(file, next) {
// do stuff with file
next(null, file);
}); |
Awesome, thanks so much. Also, the express ref links at the bottom of the page below is broken. |
Ok, diving deeper. I've built out my class to utilize postRender() and snag the view object that it passes to me, however, I'm not sure that's what I'm looking for. While that looks like I have access to the file(s) buffers for the page to render, its/their layout(s), and partial(s) used, I seem to be missing the end rendered HTML. Am I missing something? Is there a different function? |
Hmm, try changing the regex to Is that what you're looking for? |
Fantastic! that got me 99% of the way there. Adding a .HTML to the end of it returned the file content. Thanks so much for the help! End request looks like:Renderer Class
Server responce
|
great! the fwiw, |
Very cool. Now... where should I head when {{md file.md }} isn't rendering? |
stackoverflow would be a good place to start. we generally direct all implementation questions there. |
Good Morning/Afternoon/Evening,
I'm wondering if there's currently a step that might be unpublished, unseen, or simply unused where I can acquire the file buffer of the rendered file BEFORE it is saved into the file system?
For instance, say I was pairing Assemble.io with an Express server and wanted to render a specific URL on request, rather than serve a static from a pre-rendered dist folder.
The text was updated successfully, but these errors were encountered: