-
Notifications
You must be signed in to change notification settings - Fork 24
Clients shouldn't have to care about whether or not assets are precompiled #411
Comments
Seems a little unnecessary since precompiled assets are cached under tmp and quickly retrievable through the |
@josh, my reading of Asset compilation is disabled in the Rails production environment by default, which means that |
Yes. If you fully disable Sprockets, you can't use any APIs in production. So you really can't make use of |
What I'm really looking for is a simple way to ask Sprockets to "give me this asset", and have it worry about the details. It sounds like that doesn't exist right now. Am I wrong about this? Client code should not have to care whether assets have been precompiled or are being compiled on the fly. That distinction should be wholly encapsulated within Sprockets to avoid this leaking of knowledge of its internal workings into client code. Sprockets owns the asset manifest as well as the compilation functionality, so it should be able to deliver what I'm looking for. |
Yeah, its |
Sprockets is not disabled in Rails production env by default. It is loaded, If Leon Miller-Out - Singlebrook Technology - 607-330-0191 On Mon, Feb 18, 2013 at 3:58 PM, Joshua Peek notifications@github.comwrote:
|
I've now seen a couple of projects having to write branching code to retrieve an asset. It seems that we have to do different things to retrieve the asset based on whether or not it is precompiled.
https://github.com/singlebrook/premailer-rails3/commit/6fc8bf189764f2e4cb39feac65db799b39c078ec#L0R68
mileszs/wicked_pdf@ba43fda#L0R45
Since this is resulting in unexpected behavior and duplicated efforts, I think this feature should be pushed up into sprockets. To me, the most obvious way would be to make find_asset() return the precompiled asset if there is one and only attempt a compilation if there is no precompiled version.
If there already is a better way to do this, please let me know! Otherwise, I can take a crack at a pull request.
The text was updated successfully, but these errors were encountered: