Register the rails engine when using Rails w/Compass

This means that the javascripts will still be available through the
asset pipeline.
This commit is contained in:
Thomas McDonald 2012-05-11 14:39:47 +01:00
parent 4a56681111
commit 2a9d9bf4fb
4 changed files with 12 additions and 7 deletions

View File

@ -5,14 +5,15 @@ module Bootstrap
def self.load!
if compass? && asset_pipeline?
register_compass_extension
register_rails_engine
elsif compass?
# Only require compass extension if a standalone project
require 'bootstrap-sass/compass_extensions'
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/engine'
require 'bootstrap-sass/rails_extentions'
register_rails_engine
require 'bootstrap-sass/rails_functions'
else
raise Bootstrap::FrameworkNotFound, "bootstrap-sass requires either Rails > 3.1 or Compass, neither of which are loaded"
end
@ -23,6 +24,10 @@ module Bootstrap
defined?(::Rails) && ::Rails.version >= '3.1.0'
end
def self.compass?
defined?(::Compass)
end
def self.register_compass_extension
base = File.join(File.dirname(__FILE__), '..')
styles = File.join(base, 'vendor', 'assets', 'stylesheets')
@ -30,8 +35,8 @@ module Bootstrap
::Compass::Frameworks.register('bootstrap', :stylesheets_directory => styles, :templates_directory => templates)
end
def self.compass?
defined?(::Compass)
def self.register_rails_engine
require 'bootstrap-sass/engine'
end
end

View File

@ -3,5 +3,5 @@ $:.unshift("#{File.dirname(__FILE__)}/..")
require 'test/unit'
require 'sass'
require 'lib/bootstrap-sass/compass_extensions'
require 'lib/bootstrap-sass/rails_extentions'
require 'lib/bootstrap-sass/compass_functions'
require 'lib/bootstrap-sass/rails_functions'