jinja2-cli icon indicating copy to clipboard operation
jinja2-cli copied to clipboard

Add -i/--includes option extending template search path

Open georgespalding opened this issue 6 years ago • 12 comments

This is useful for reuse when a set of shared templates are maintained in another directory by using {% include 'lib/header.j2' %} style includes.

Closes #75

georgespalding avatar Mar 25 '19 12:03 georgespalding

Hey, this is great! Lemme take a closer look at this.

mattrobenolt avatar Mar 26 '19 19:03 mattrobenolt

I also have a use for this! Any reason why this is not getting merged? 🤔

mvgijssel avatar Nov 16 '20 20:11 mvgijssel

TBH I forgot about this. Should I merge it?

georgespalding avatar Jun 03 '21 12:06 georgespalding

Reopen after implementing feedback from @mykhailo-inv-disco

georgespalding avatar Aug 17 '21 14:08 georgespalding

@georgespalding Please take a look at this PR: https://github.com/videoplaza/jinja2-cli/pull/3 . I've added some tests with and without --includes flag. I've got too many templates 🤕 )

IrSent avatar Sep 11 '21 15:09 IrSent

@mattrobenolt Anything else you'd like fixed before merging?

georgespalding avatar Sep 15 '21 21:09 georgespalding

btw, if you need --includes flag set to templates root but cannot wait for the new version of the jinja2-cli package to be released, as a temporary workaround, you can copy a template into the template root just before rendering it (also don't forget to remove it afterwards), and now you can have predictable imports inside templates.

IrSent avatar Sep 23 '21 21:09 IrSent

thanks for the workaround.

boxxxie avatar Apr 17 '23 02:04 boxxxie

Would be really great to get this merged :( This version is packaged in most of the distros ....

thrix avatar Apr 29 '24 15:04 thrix

+1, I just ran into this issue and currently exploring available options.

@mattrobenolt , I noticed the latest release was done over 2 years ago. Is there anything we can do here?

mcrozes avatar Apr 30 '24 11:04 mcrozes