This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Method to retrieve a list of dependencies used to compile a template #233
Labels
You can continue the conversation there. Go to discussion →
Hello! I've poked around a bit but haven't had any luck figuring out if this is already possible — is there/could there be a way to determine what all files were involved in compiling a template? This would essentially be the list of "dependencies" that went into preparing a template. This would be useful for setting up a file watcher or doing intelligent re-compiles of templates only when one of a template's dependencies change.
Some examples in the wild:
In Nunjucks this is handled by an
.on('load')
event on the Nunjucks instance itself, but IMO it suffers from a couple flaws — it's not clear which input file being rendered triggered a load event, and setting this up is removed from the compile process.In
dart-sass
this is undocumented but each render returns a list ofincludedFiles
which references every single sass file that was touched in the process of preparing the styles. This is particularly ideal because there's no confusion as to how an entrypoint was prepared — this list is part of the render's response.I will admit I am not 100% familiar with how
liquidjs
parses files and whether it eagerly does so or not, but I could imagine some sort of reference being added toTemplate
instances (AKA the return value ofparse
andparseFile
) may be workable.The text was updated successfully, but these errors were encountered: