diet-ng
diet-ng copied to clipboard
Cache views in the same subdirectory as their template
See #5
How about using something like .replace('/', '_')
, so that deeper nestings also work?
BTW, do nested string imports directories work on Windows for the latest DMD versions? They used to work only on other systems, but there was an effort to remove that restriction recently.
If cached views are going to be decoupled from their templates, why not place them in a special directory like /views/_cached_/
to avoid polluting /views/
?
BTW, do nested string imports directories work on Windows for the latest DMD versions?
I don't run windows to be able to tell you.
why not place them in a special directory like /views/cached/ to avoid polluting /views/?
Basically just because of the Windows path issue. I'll have to try this out in the evening when I get access to a Windows machine.
Okay, finally got the chance to test and it still doesn't work on Windows. So for now, the _cached_
prefix needs to stay. But hopefully all of this will soon be obsoleted with the new CTFE engine.
This still is a problem, and prevents using cached templates along with organizing your views into subdirectories.
A simple fix I thought of is to apply only a suffix to the filename instead of a prefix. So e.g.:
enum _diet_cache_file_name = filename~"_cached_"~_diet_hash.to!string~".d"
This would be immune to issues with paths in the filename. It's also a lot simpler than the building of a path. Make sense?
See #72 for an alternate solution to this.
This should be closed now.