Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

make 'ignore missing' an option on Swig Options object #44

Open
steevhise opened this issue Sep 23, 2017 · 4 comments
Open

make 'ignore missing' an option on Swig Options object #44

steevhise opened this issue Sep 23, 2017 · 4 comments

Comments

@steevhise
Copy link

It seems reasonable to want an "ignore missing" setting that is more general, in other words that can apply everywhere and not need to specify it for each specific use of the "include" tag. Perhaps it should even apply to entire templates that are missing. Why not make it an option to pass to the Swig Options object?

@cdaringe
Copy link
Contributor

similar to #45, i somewhat think this is a preprocessing concern. im not super against it, but im having a little bit of skepticism seeing it as swig's responsibility. maybe you can paint a use case where it really helps/would-help to sell it?

@steevhise
Copy link
Author

I admit that applying to an entire template is perhaps a stretch. But if there's already an "ignore missing" option for the include tag, it seems like having a global setting for all include tags wouldn't be much of an additional performance hit. ( One use case is having a set of template partials that I want to optionally bring in from another package. I'd want the templates that include them to not fail if that package isn't present, without having to go in and add "ignore missing" to every include tag. )

@steevhise
Copy link
Author

I've written a custom template loader that does this, as well as #45. So no worries if y'all don't want to implement these.

@steevhise
Copy link
Author

Here's a gist of our custom template loader that basically solves both this and #45: https://gist.github.com/steevhise/2ddac162d43c3a6112d3e983c73b4e32

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants