sikachu / sprockets-redirect

A Rack middleware for Rails >= 3.1.0 with asset pipeline and asset digest enabled. This middleware is used to redirect any request to static asset without a digest to the version with digest in its filename by reading the assets manifest file generated after you run `rake assets:precompile`
http://rubygems.org/gems/sprockets-redirect
MIT License
72 stars 26 forks source link

Doesn’t work with Rails 4.2? #11

Closed mattsears closed 8 years ago

mattsears commented 9 years ago

I'm using this in a Rails 4.2 app and it doesn’t seem to work. I believe the issue is that there is no manifest.yml anymore? Rails 4.2 stores it as JSON now. I'm not entirely sure though.

sikachu commented 9 years ago

We recently updated the gem to support Rails 4.2, and we have several projects that running Rails 4.2 with 0.3.0 gem. Can you confirm that you see Sprockets::Redirect when you run rake middleware?

mattsears commented 9 years ago

Yes, I it shows Sprocket::Redirect on production:

use Sprockets::Redirect
use Rack::Sendfile
use Rack::Lock
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007ffceeecaf48>
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use ActionDispatch::RemoteIp
use ActionDispatch::Callbacks
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use Warden::Manager
run Brattle::Application.routes

I also have the following config settings in production.rb:

# Compress JavaScripts and CSS
config.assets.compress = true

#Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false

# Generate digests for assets URLs
config.assets.digest = true

I appreciate your help on this. When I load http://example.org/assets/application.js I get a 404

Not sure what I'm doing wrong?

sikachu commented 8 years ago

I just fixed the problem with Sprockets Rails 3.0.0 which I think was causing an issue for people using Rails 4.2 in 3f501213769e207a2ba421523156ae10512b87fa so I'm going to close this. Please let me know if this issue still persisted.