mirror of
https://github.com/twbs/bootstrap-sass.git
synced 2022-11-09 12:27:02 -05:00
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:
parent
4a56681111
commit
2a9d9bf4fb
4 changed files with 12 additions and 7 deletions
|
@ -5,14 +5,15 @@ module Bootstrap
|
||||||
def self.load!
|
def self.load!
|
||||||
if compass? && asset_pipeline?
|
if compass? && asset_pipeline?
|
||||||
register_compass_extension
|
register_compass_extension
|
||||||
|
register_rails_engine
|
||||||
elsif compass?
|
elsif compass?
|
||||||
# Only require compass extension if a standalone project
|
# Only require compass extension if a standalone project
|
||||||
require 'bootstrap-sass/compass_extensions'
|
require 'bootstrap-sass/compass_functions'
|
||||||
register_compass_extension
|
register_compass_extension
|
||||||
elsif asset_pipeline?
|
elsif asset_pipeline?
|
||||||
require 'sass-rails' # See: https://github.com/thomas-mcdonald/bootstrap-sass/pull/4
|
require 'sass-rails' # See: https://github.com/thomas-mcdonald/bootstrap-sass/pull/4
|
||||||
require 'bootstrap-sass/engine'
|
register_rails_engine
|
||||||
require 'bootstrap-sass/rails_extentions'
|
require 'bootstrap-sass/rails_functions'
|
||||||
else
|
else
|
||||||
raise Bootstrap::FrameworkNotFound, "bootstrap-sass requires either Rails > 3.1 or Compass, neither of which are loaded"
|
raise Bootstrap::FrameworkNotFound, "bootstrap-sass requires either Rails > 3.1 or Compass, neither of which are loaded"
|
||||||
end
|
end
|
||||||
|
@ -23,6 +24,10 @@ module Bootstrap
|
||||||
defined?(::Rails) && ::Rails.version >= '3.1.0'
|
defined?(::Rails) && ::Rails.version >= '3.1.0'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.compass?
|
||||||
|
defined?(::Compass)
|
||||||
|
end
|
||||||
|
|
||||||
def self.register_compass_extension
|
def self.register_compass_extension
|
||||||
base = File.join(File.dirname(__FILE__), '..')
|
base = File.join(File.dirname(__FILE__), '..')
|
||||||
styles = File.join(base, 'vendor', 'assets', 'stylesheets')
|
styles = File.join(base, 'vendor', 'assets', 'stylesheets')
|
||||||
|
@ -30,8 +35,8 @@ module Bootstrap
|
||||||
::Compass::Frameworks.register('bootstrap', :stylesheets_directory => styles, :templates_directory => templates)
|
::Compass::Frameworks.register('bootstrap', :stylesheets_directory => styles, :templates_directory => templates)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.compass?
|
def self.register_rails_engine
|
||||||
defined?(::Compass)
|
require 'bootstrap-sass/engine'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,5 @@ $:.unshift("#{File.dirname(__FILE__)}/..")
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
|
||||||
require 'sass'
|
require 'sass'
|
||||||
require 'lib/bootstrap-sass/compass_extensions'
|
require 'lib/bootstrap-sass/compass_functions'
|
||||||
require 'lib/bootstrap-sass/rails_extentions'
|
require 'lib/bootstrap-sass/rails_functions'
|
Loading…
Reference in a new issue