diff options
author | Tristan Harward <trisweb@gmail.com> | 2013-03-21 19:26:25 +0400 |
---|---|---|
committer | Tristan Harward <trisweb@gmail.com> | 2013-03-21 19:26:25 +0400 |
commit | 2be2d7d13074d16ea6ca0856cc298dcc6146c449 (patch) | |
tree | ecaff18bed311d4ca11450b69250b82da2ab8154 /lib/bootstrap-sass.rb | |
parent | 62d239b9c0649bf584e3f5a88835ac22e981e9a1 (diff) |
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)
Diffstat (limited to 'lib/bootstrap-sass.rb')
-rw-r--r-- | lib/bootstrap-sass.rb | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/bootstrap-sass.rb b/lib/bootstrap-sass.rb index e80ad4c2..94846e4a 100644 --- a/lib/bootstrap-sass.rb +++ b/lib/bootstrap-sass.rb @@ -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') |