-
Notifications
You must be signed in to change notification settings - Fork 68
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
Global partial dir #30
Comments
I was thinking about this but I am uncertain if this is a good idea. While it makes your instance significantly easier, I would have to explicitly define behavior so that it doesn't break for others. Imagine a folder structure like this:
Also, imagine The second aspect I think about is if you allow a variable name or another way to determine where the templates are so you could be more explicit.
And that, I think, brings up the part where I believe the paths are wrong inside templates. Let's say I was in Mustache spec kinda leaves this open, as though all templates are registered with the engine in advance with unique names. I could do that instead, but that would defeat some of the flexibility of this tool. What are your thoughts? |
My first thoughts are that I really want to avoid putting the path inside the templates, even as a variable, for the reasons you outlined. I also see the issues you mention with relative directories.. Just FYI - I would use So for Support a For me the above would work cos if I need to keep a large number of partials in different dirs, I could set |
Would you want to check out the Example:
Using
Without the absolute paths, the search paths will be applied to where the templates are located, which would probably produce unexpected results. |
Sounds great, I'll have a look soon.. Sorry for the late reply. |
My life has certainly been busy this summer, and I can easily understand if your time was consumed by more pressing things. Were you able to give the branch a test to see if it solves the problems you were reporting? |
Split from #28 by @sc0ttj:
Partials seem not to work very well for me.. I think having an env var set like
$MO_PARTIAL_DIR
would be great - cos mo struggles to find the partials without defining full paths when used in more complex programs.. "Complex" means they may have scripts that live in different dirs, away from mo itself, outside of$PATH
, changing$PWD
a lot, etc..Can mo be made to use a
$MO_PARTIAL_DIR
env var, so that templates can be made as below, and will work:^ should work regardless of where
mo
is lives, or is called from, or where the template lives... the filemy_file
could actually be at${MO_PARTIAL_DIR}/myfile[.mustache]
..The text was updated successfully, but these errors were encountered: