-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use precompiled assets if possible #64
Conversation
…<leon@singlebrook.com>)
Changes Unknown when pulling ace8dd9 on gucki:master into * on fphilipe:master*. |
If the assets are precompiled, then they're stored inside the public folder, right? Then why not just return nil and let the |
I was thinking, that this could be refactored as follows.
I'd like to include a rails app in the tests to make sure this really works. Any thoughts on this? Pinging @sbleon since he was the original author. |
Copy of @sbleon's comment on #55:
|
@sbleon I think the order I suggested in my previous comment should work. AssetPipelineLoader would return nil if the assets are precompiled, i.e. not available. Don't you think that would work? |
Not on Heroku. Heroku injects a Rails plugin |
Well, I think it would be possible as it is done in this pull request: def assets_precompiled?
!::Rails.configuration.assets.compile rescue false
end But indeed, it might be wiser to first check the file system and after that check for the asset pipeline and after that perform a request to the asset host. |
That's the setting that Heroku forces to I'm glad you're on board with checking the file system first. I was looking I'll try to take a crack at this soon if I get a chance. On Wed, Apr 10, 2013 at 12:01 PM, Philipe Fatio notifications@github.comwrote:
|
Any updates on this? I'm experiencing this problem on Heroku, although only in a staging environment. |
@kellyfelkins I was thinking that the asset loading could be extracted into its own gem since it might be of interest for others. Unfortunately, I didn't have time yet to do so. |
I decided to go with the gucki fork. https://github.com/gucki/premailer-rails.git It's working fine for me. What I did not figure out is why I had a problem in a staging environment, but not in production. Both environments are on Heroku. -Kelly |
def file_name(path) | ||
path.sub("#{::Rails.configuration.assets.prefix}/", '') \ | ||
.sub(/-.*\.css$/, '.css') | ||
path.sub("#{::Rails.configuration.assets.prefix}/", '').sub(/-.*\.css$/, '.css') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this is only a whitespace change -- you should revert it so that the diff is more minimal (and it does indeed conflict with current master)
Use precompiled assets if present (original patch by Leon Miller-Out <leon@singlebrook.com>) Conflicts: lib/premailer/rails/css_loaders.rb
See #55 (comment)
Works for me with rails 3.2.12 ... :)