Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Names generation for precompiled templates on windows. #698

Open
sunrize531 opened this issue Mar 14, 2016 · 5 comments
Open

Names generation for precompiled templates on windows. #698

sunrize531 opened this issue Mar 14, 2016 · 5 comments

Comments

@sunrize531
Copy link

I'm trying to re-organise my templates in subdirectories. But since I use windows, pre-generated template names look like: pages\\dashboard\\index.html, which is very inconvenient, especially if we decide to pre-compile templates on our rundeck machines. I probably could try to use a custom loader, but I'd suggest to either always use unix-style addresses for auto-generated template names, or give an option to customise template names generation, by providing a function as a name option for precompile method.

@carljm
Copy link
Contributor

carljm commented Mar 14, 2016

I'd be ok with either of those proposals; PR welcome!

Always using Unix-style by default is a change that would probably need to wait for 3.0, since it's backwards-incompatible.

@botic
Copy link

botic commented Apr 13, 2016

Same problem here. We run some dev machines on Windows, so their template cannot be loaded since their paths contain \\ instead of /. My first approach was to search for an option for precompile, but there is none.

@carljm: I think this is a bug, not just an enhancement since it breaks precompiling templates on Windows.

@carljm
Copy link
Contributor

carljm commented Apr 15, 2016

@botic Well, it means that templates precompiled on Windows cannot be used on Unix, and vice versa. If you were in a consistently Windows environment, it wouldn't be broken, would it?

I think the right solution is to normalize to Unix-style pathnames. Whether it's a bug or an enhancement doesn't really matter; either way it'll get done when someone makes a pull request (shouldn't be too hard). The real question is whether we can safely add it in 2.x or whether it's a backwards-incompatible change that needs to wait for 3.0. Which boils down to the question of whether there are a significant number of current nunjucks users on Windows who already have code that refers to their templates using the backslashed name.

It wouldn't take much to convince me that that's probably not the case.

@fredericnowak
Copy link

Is there a fix in 3.0 for that ?

@rhengles
Copy link
Contributor

@growak This should have been fixed since #761 and #825

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

No branches or pull requests

5 participants