Currently to require a javascript template file, I put the file in app/assets/javascripts/templates, and include a line like this in a javascript file:
// = require templates/cool_thing.jst
And then I access the template in my javascript like this:
JST['templates/cool_thing']
This works fine, of course, but it requires having my templates put in a subdirectory of the assets/javascript folder. Templates are a large part of my project and I’d really like them to have their own space.
Ideally, I’d love to have my rails 3 assets folder organized like this:
- Assets
- javascripts
- templates
- stylesheets
And then require the templates like thus:
// = require templates/cool_thing.jst
And access them in javascript like this:
JST['cool_thing']
Is this possible, and if so how is it done?
Add this to your application.rb config: