Module: RailsAdmin::Bootstrap
- Defined in:
- lib/rails_admin/bootstrap-sass.rb
Defined Under Namespace
Classes: FrameworkNotFound
Class Method Summary
collapse
Class Method Details
.asset_pipeline? ⇒ Boolean
26
27
28
|
# File 'lib/rails_admin/bootstrap-sass.rb', line 26
def self.asset_pipeline?
defined?(::Sprockets)
end
|
.compass? ⇒ Boolean
30
31
32
|
# File 'lib/rails_admin/bootstrap-sass.rb', line 30
def self.compass?
defined?(::Compass)
end
|
.load! ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/rails_admin/bootstrap-sass.rb', line 6
def self.load!
if compass?
require 'rails_admin/bootstrap-sass/compass_functions'
register_compass_extension
elsif asset_pipeline?
require 'rails_admin/bootstrap-sass/sass_functions'
end
require 'sassc-rails' if rails?
unless rails? || compass?
raise(Bootstrap::FrameworkNotFound.new('bootstrap-sass requires either Rails > 3.1 or Compass, neither of which are loaded'))
end
if defined?(::Sass) && ::Sass.respond_to?(:load_paths)
stylesheets = File.expand_path(File.join('..', 'vendor', 'assets', 'stylesheets'))
::Sass.load_paths << stylesheets
end
end
|
.rails? ⇒ Boolean
34
35
36
|
# File 'lib/rails_admin/bootstrap-sass.rb', line 34
def self.rails?
defined?(::Rails)
end
|
.register_compass_extension ⇒ Object
38
39
40
41
42
43
|
# File 'lib/rails_admin/bootstrap-sass.rb', line 38
def self.register_compass_extension
base = File.join(File.dirname(__FILE__), '..')
styles = File.join(base, 'vendor', 'assets', 'stylesheets')
templates = File.join(base, 'templates')
::Compass::Frameworks.register('bootstrap', path: base, stylesheets_directory: styles, templates_directory: templates)
end
|