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

Configurable paths #7

Closed
vojtajina opened this issue May 4, 2013 · 5 comments
Closed

Configurable paths #7

vojtajina opened this issue May 4, 2013 · 5 comments

Comments

@vojtajina
Copy link
Contributor

The path - cache key needs to be configurable.

@vojtajina
Copy link
Contributor Author

Guys, any ideas on how to call that config ? cacheIdFromPath ?

I'm gonna make it a function that transforms the filepath into the cache key. By default, it's gonna be identity...

@kadamwhite
Copy link

So you could pass in another function, which could transform the key in an arbitrary way? That could work. Alternately, the main use-case I see for this is the one we ran into, where your templates are loaded w/ a root-relative URL path. In that context, all we would need is the ability to specify a prefix to be appended to the cache key, similar to basePath.

The former is more flexible, while the latter is simpler.

@vojtajina
Copy link
Contributor Author

prefix to basePath would be simpler... but sometimes it's not enough... (you might want to remove some prefix as well)

eg. you have directory basePath/app/tpl/*.html and your web server serves them as /static/tpl/*.html.

@vojtajina
Copy link
Contributor Author

So I think, there are two options, I definitely wanna keep it simple.

1/ a transform function that takes the filepath (relative to basePath) and returns the $templateCache key, by default, it's identity function

2/ prependPrefix and stripPrefix (both default to an empty string); stripPrefix is stripped from the relative filepath, prependPrefix is prepended to the filepath.

@kadamwhite
Copy link

I'd vote for # 1 (transformation function), it seems to be the most explicit.

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

No branches or pull requests

2 participants