railsware / sht_rails

Shared handlebars templates for Rails 3
http://blog.railsware.com/2012/05/21/shared-handlebars-templates-for-rails-3/
MIT License
76 stars 21 forks source link

Underscores in template paths kill sht_rails (wtf) #22

Closed whatyouhide closed 10 years ago

whatyouhide commented 10 years ago

Directory structure:

app
| templates
  | highlighted_posts
    | _option.hbs
  | tags
    | _single_tag.hbs

SHT['tags/single_tag'] works fine, SHT['highlighted_posts/option'] is undefined.

wtf? It happens only with directory names, not with filenames.

le0pard commented 10 years ago

What is result of SHT keys? You can look at object at Chrome of Firefox console.

whatyouhide commented 10 years ago

I wrote it in the issue. I got something like this:

Object {tags/single_tag: function}
le0pard commented 10 years ago

Is folder highlighted_posts added in manifest?

whatyouhide commented 10 years ago

I didn't specify any directories in the manifest since I used (actually as suggested in the README) require_tree, in practice requiring templates/**/*.

I'm telling you, it's the underscore in the directory name that freaks sht_rails out.

le0pard commented 10 years ago

Just use the same names for folder and file. All works as expected: http://monosnap.com/image/5T3ZpsYbckSuPV79HM9HX9plZrEJNg

le0pard commented 10 years ago

Example of app: http://smt.rw.rw/ Source code: https://github.com/le0pard/st_rails_example

whatyouhide commented 10 years ago

Closing this issue too, everything works with underscores in the template paths. Thanks!