Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions

What is the directory priority for templates?


Reply

3 Posts   385 Views

Avatar
mattdwen

14 February 2014 at 5:58pm (Last edited: 14 February 2014 5:59pm), Community Member, 12 Posts

I have the following structure in a custom theme:
- src
- src/templates
- templates

The /src/templates are compiled into the /templates dir using Grunt. However the files from /src/templates are actually the files which get loaded.

I thought it may be parsing the folders alphabetically, so I renamed src to zzz, run a flush=all, and still the template from zzz/templates was the file loaded.

It wasn't until I renamed zzz/templates to zzz/nottemplates that the correct templates/Page.ss was loaded.

Why are sub folders checked for template directories? Surely this a reasonable performance hit checking every subfolder except the real templates for it's own templates directory?

Avatar
Willr

15 February 2014 at 10:38pm Forum Moderator, 5511 Posts

Why are sub folders checked for template directories? Surely this a reasonable performance hit checking every subfolder except the real templates for it's own templates directory?

As it's part of the manifest, it's only a performance hit on flush. If you include a _manifest_exclude_ file in src/templates that should get it ignored.

Avatar
mattdwen

20 February 2014 at 1:23pm Community Member, 12 Posts

Thanks Willr, I had to remove the trailing _ but it worked a treat, cheers :)