Open cfjedimaster opened 2 years ago
Note that you can bypass the output of a file altogether with
return;
as the sole return line.
this is documented for 11ty.js templates here btw https://www.11ty.dev/docs/languages/javascript/#function
and i think it makes sense that that can be done in a transform too, even if it's not explicitly mentioned in the transform documentation, because a transform is about taking content and returning transformed content.
So maybe this wasn't the intent, but... I've built a demo that uses transforms to notice when the destination is PDF. When it has, it creates a PDF version of the HTML and returns the binary data. Initially I was getting a corrupted PDF. But I noticed that if I returned null from transform, I got an error:
So a whim, I did this:
And it worked well. I'd say this should be documented, or if it's not intended, then only allow strings back. (I won't be upset. ;)