From 3a91399a45428631d61ff81ea988e17bcdd74e06 Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Wed, 4 Nov 2015 22:33:31 -0800 Subject: [PATCH] Workaround for https://github.com/kirtithorat/carrierwave-crop/issues/17, inspired by https://github.com/twbs/bootstrap-sass/blob/master/lib/bootstrap-sass/engine.rb. --- {vendor/assets => assets}/images/Jcrop.gif | Bin {vendor/assets => assets}/javascripts/.keep | 0 .../assets => assets}/javascripts/jquery.jcrop.js | 0 {vendor/assets => assets}/stylesheets/.keep | 0 .../stylesheets/jquery.jcrop.css.erb | 2 +- lib/carrierwave/crop/engine.rb | 6 ++++++ 6 files changed, 7 insertions(+), 1 deletion(-) rename {vendor/assets => assets}/images/Jcrop.gif (100%) rename {vendor/assets => assets}/javascripts/.keep (100%) rename {vendor/assets => assets}/javascripts/jquery.jcrop.js (100%) rename {vendor/assets => assets}/stylesheets/.keep (100%) rename vendor/assets/stylesheets/jquery.jcrop.css => assets/stylesheets/jquery.jcrop.css.erb (98%) diff --git a/vendor/assets/images/Jcrop.gif b/assets/images/Jcrop.gif similarity index 100% rename from vendor/assets/images/Jcrop.gif rename to assets/images/Jcrop.gif diff --git a/vendor/assets/javascripts/.keep b/assets/javascripts/.keep similarity index 100% rename from vendor/assets/javascripts/.keep rename to assets/javascripts/.keep diff --git a/vendor/assets/javascripts/jquery.jcrop.js b/assets/javascripts/jquery.jcrop.js similarity index 100% rename from vendor/assets/javascripts/jquery.jcrop.js rename to assets/javascripts/jquery.jcrop.js diff --git a/vendor/assets/stylesheets/.keep b/assets/stylesheets/.keep similarity index 100% rename from vendor/assets/stylesheets/.keep rename to assets/stylesheets/.keep diff --git a/vendor/assets/stylesheets/jquery.jcrop.css b/assets/stylesheets/jquery.jcrop.css.erb similarity index 98% rename from vendor/assets/stylesheets/jquery.jcrop.css rename to assets/stylesheets/jquery.jcrop.css.erb index 95f8b9c..83e2931 100755 --- a/vendor/assets/stylesheets/jquery.jcrop.css +++ b/assets/stylesheets/jquery.jcrop.css.erb @@ -15,7 +15,7 @@ /* Selection Border */ .jcrop-vline, .jcrop-hline { - background: #ffffff url("Jcrop.gif"); + background: #ffffff url('<%= asset_path "Jcrop.gif" %>'); font-size: 0; position: absolute; } diff --git a/lib/carrierwave/crop/engine.rb b/lib/carrierwave/crop/engine.rb index c79adc7..478e4b7 100644 --- a/lib/carrierwave/crop/engine.rb +++ b/lib/carrierwave/crop/engine.rb @@ -3,6 +3,12 @@ module CarrierWave module Crop class Engine < ::Rails::Engine + initializer 'bootstrap-sass.assets.precompile' do |app| + %w(stylesheets javascripts images).each do |sub| + app.config.assets.paths << root.join('assets', sub).to_s + end + app.config.assets.precompile += %w( Jcrop.gif ) + end end end end