Open andrewhao opened 11 years ago
Tell us a bit about your use case, please.
@jashkenas: I'm stuck in a Rails 2 app which on a per-controller basis loads in a custom stylesheet/script tag. Say I need to load "admin.js".
Now in a content_for
block in my view, I had simply been rendering javascript_include_tag :admin
. I'd like to basically render include_javascripts :admin
and use the Jammit package if it exists, and otherwise fall back to javascript_include_tag
if it doesn't.
Sounds pretty special case. Can't you just define these custom asset packages, and use them? Too many? Even to do in a loop in ERB in your assets.yml?
@jashkenas Yep, those are all valid alternatives. I just thought it'd be nice to add an extra layer of abstraction so I didn't have to know about Jammit configuration implementation.
What are your concerns? I could perhaps extract this method into a new Jammit::Configuration
object if you're concerned about model bloat.
This allows us to detect the existence of a packaged asset at runtime, and gives us the ability to determine whether to call the Jammit stylesheet/javascript helper or the default Rails tag helpers.