No commit activity in last 3 years
No release in over 3 years
Rack middleware to make missing local paperclip assets fall back to remote ones
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
~> 10.0
~> 3.0

Runtime

>= 3.1
 Project Readme

Paperclip Remote Assets

Rack middleware for Rails development environment to make missing local Paperclip assets fall back to remote assets on a given target URL.

When a request to your app is done in development mode starting with /system/, the middleware checks if the file exists in your public/system folder and redirects to the remote target if it doesn't.

Note : This only works if your local assets storing path matches the remote one.

Installation

Add this line to your application's Gemfile, in the development group:

group :development do
  gem 'paperclip-remote_assets'
end

And then execute:

$ bundle

Or install it yourself as:

$ gem install paperclip-remote_assets

Usage

Set your remote target root either with the REMOTE_ASSETS_ROOT environment variable, or with the Paperclip::RemoteAssets.remote_root config.

ENV['REMOTE_ASSETS_ROOT'] = 'http://www.my-production-domain.com'

alternatively, in some initializer or environment file :

Paperclip::RemoteAssets.remote_root = 'http://www.my-production-domain.com'

If your remote assets root path does not start with /system, you can set the following flag, so the middleware strips the leading /system from the requested path.

ENV['REMOTE_ASSETS_ROOT_INCLUDES_SYSTEM'] = 'false'

alternatively, in some initializer or environment file :

Paperclip::RemoteAssets.remote_root_includes_system = false

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/glyph-fr/paperclip-remote_assets.

License

The gem is available as open source under the terms of the MIT License.