lib/bootstrap-sass.rb in bootstrap-sass-3.3.1.0 vs lib/bootstrap-sass.rb in bootstrap-sass-3.3.2.0
- old
+ new
@@ -2,11 +2,17 @@
module Bootstrap
class << self
# Inspired by Kaminari
def load!
register_compass_extension if compass?
- register_rails_engine if rails?
+
+ if rails?
+ register_rails_engine
+ elsif sprockets?
+ register_sprockets
+ end
+
configure_sass
end
# Paths
def gem_path
@@ -28,11 +34,11 @@
def assets_path
@assets_path ||= File.join gem_path, 'assets'
end
# Environment detection helpers
- def asset_pipeline?
+ def sprockets?
defined?(::Sprockets)
end
def compass?
defined?(::Compass)
@@ -47,12 +53,12 @@
def configure_sass
require 'sass'
::Sass.load_paths << stylesheets_path
- # bootstrap requires minimum precision of 10, see https://github.com/twbs/bootstrap-sass/issues/409
- ::Sass::Script::Number.precision = [10, ::Sass::Script::Number.precision].max
+ # bootstrap requires minimum precision of 8, see https://github.com/twbs/bootstrap-sass/issues/409
+ ::Sass::Script::Number.precision = [8, ::Sass::Script::Number.precision].max
end
def register_compass_extension
::Compass::Frameworks.register(
'bootstrap',
@@ -63,9 +69,15 @@
)
end
def register_rails_engine
require 'bootstrap-sass/engine'
+ end
+
+ def register_sprockets
+ Sprockets.append_path(stylesheets_path)
+ Sprockets.append_path(fonts_path)
+ Sprockets.append_path(javascripts_path)
end
end
end
Bootstrap.load!