Reorganize loader for compass support
::Sprockets is the wrong check, since we reference the ::Rails constant directly in the loaded file. This was outright failing when used with an empty compass-sprockets-sass install (without Rails)
This commit is contained in:
Родитель
62d239b9c0
Коммит
2be2d7d130
|
@ -3,20 +3,22 @@ module Bootstrap
|
|||
|
||||
# Inspired by Kaminari
|
||||
def self.load!
|
||||
if compass? && asset_pipeline?
|
||||
register_compass_extension
|
||||
register_rails_engine
|
||||
elsif compass?
|
||||
# Only require compass extension if a standalone project
|
||||
if compass?
|
||||
require 'bootstrap-sass/compass_functions'
|
||||
register_compass_extension
|
||||
elsif asset_pipeline?
|
||||
require 'sass-rails' # See: https://github.com/thomas-mcdonald/bootstrap-sass/pull/4
|
||||
require 'bootstrap-sass/sass_functions'
|
||||
end
|
||||
|
||||
if rails?
|
||||
require 'sass-rails'
|
||||
register_rails_engine
|
||||
require 'bootstrap-sass/rails_functions'
|
||||
else
|
||||
end
|
||||
|
||||
if !(rails? || compass?)
|
||||
raise Bootstrap::FrameworkNotFound, "bootstrap-sass requires either Rails > 3.1 or Compass, neither of which are loaded"
|
||||
end
|
||||
|
||||
stylesheets = File.expand_path(File.join("..", 'vendor', 'assets', 'stylesheets'))
|
||||
::Sass.load_paths << stylesheets
|
||||
end
|
||||
|
@ -30,6 +32,10 @@ module Bootstrap
|
|||
defined?(::Compass)
|
||||
end
|
||||
|
||||
def self.rails?
|
||||
defined?(::Rails)
|
||||
end
|
||||
|
||||
def self.register_compass_extension
|
||||
base = File.join(File.dirname(__FILE__), '..')
|
||||
styles = File.join(base, 'vendor', 'assets', 'stylesheets')
|
||||
|
|
Загрузка…
Ссылка в новой задаче