From 3e0fafa09a362e601372d078926398c59ba91d67 Mon Sep 17 00:00:00 2001 From: Lucas Mazza Date: Tue, 8 Sep 2015 23:37:34 -0300 Subject: [PATCH] Add support for `sprockets-rails` 3 and `sprockets` 4. `sprockets-rails` 3 already precompiles any asset that is referenced by the `font-path` and `image-path` helpers, and `sprockets` 4 does not support Regexpes as the `precompile` flag. --- lib/bootstrap-sass/engine.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/bootstrap-sass/engine.rb b/lib/bootstrap-sass/engine.rb index fe5c4a6ecd..d288080e8a 100644 --- a/lib/bootstrap-sass/engine.rb +++ b/lib/bootstrap-sass/engine.rb @@ -5,7 +5,12 @@ class Engine < ::Rails::Engine %w(stylesheets javascripts fonts images).each do |sub| app.config.assets.paths << root.join('assets', sub).to_s end - app.config.assets.precompile << %r(bootstrap/glyphicons-halflings-regular\.(?:eot|svg|ttf|woff2?)$) + + # sprockets-rails 3 tracks down the calls to `font_path` and `image_path` + # and automatically precompiles the referenced assets. + unless Sprockets::Rails::VERSION.starts_with?('3') + app.config.assets.precompile << %r(bootstrap/glyphicons-halflings-regular\.(?:eot|svg|ttf|woff2?)$) + end end end end