sstephenson / eco

Embedded CoffeeScript templates
MIT License
1.71k stars 70 forks source link

Can't use a unique key for the compiled js object #61

Open jophde opened 11 years ago

jophde commented 11 years ago

I would like to be able to have subdirectories in my template directory based on the resources in my app. Within each resource directory there would be eco templates such as index.html.eco, show.html.eco, etc. I made a script that can find all the eco files recursively in the template directory however anything with the same file name gets overwritten in the ecoTemplate object. Is their a way to change the generation of the key for the object to include some name spacing base on the directory the template is in?

Templates -->
  User -> 
    index.html.eco

  Post ->
    index.html.eco

#! /bin/bash

find src/templates -type f -name *.eco -exec eco -o www/js/eco {} \;
cat www/js/eco/* > vendors/templates.js

This will cause templates.js to only one ecoTemplates["index.html"] since the index.eco.js is overwritten in www/js/eco.