Challenges processing JavaScript as custom template format #2993
Unanswered
greatislander
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I've been working on using
esbuild
to bundle JavaScript assets for an Eleventy site via a custom template format. As the site uses*.11tydata.js
files, I need to make sure that they aren't processed as templates. I've tried skipping these templates from inside thecompile
function (as demonstrated here) and also by using thecompileOptions.permalink
option (as demonstrated here). However, Eleventy still tries to process an*.11tydata.js
file as a template if that file attempts to define a permalink withineleventyComputed
. My guess is that thecompile
skip logic andcompileOptions.permalink
logic are superseded by the permalink in the computed data which causes Eleventy to try to render the*.11tydata.js
file. I've created a minimal reproduction of the issue here:https://github.com/greatislander/js-template-format
To see what I mean, you can clone this repository and run
npm run debug
. Then comment out this line and try again. In the first instance the build fails and you can see that Eleventy is treating the JavaScript data file as a template, while in the second instance the build succeeds.Any insights on how to avoid this issue would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions