/
font-awesome-sass.rb
59 lines (48 loc) · 1.18 KB
/
font-awesome-sass.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
module FontAwesome
module Sass
class << self
def load!
if rails?
register_rails_engine
elsif sprockets?
register_sprockets
elsif deprecated_sass?
::Sass.load_paths << stylesheets_path
end
end
# Paths
def gem_path
@gem_path ||= File.expand_path('..', File.dirname(__FILE__))
end
def stylesheets_path
File.join(assets_path, 'stylesheets')
end
def fonts_path
File.join(assets_path, 'fonts')
end
def assets_path
@assets_path ||= File.join(gem_path, 'assets')
end
def sprockets?
defined?(::Sprockets)
end
def rails?
defined?(::Rails)
end
def deprecated_sass?
# The deprecated `sass` gem:
defined?(::Sass) && ::Sass.respond_to?(:load_paths)
end
private
def register_rails_engine
require 'font_awesome/sass/rails/engine'
require 'font_awesome/sass/rails/railtie'
end
def register_sprockets
Sprockets.append_path(stylesheets_path)
Sprockets.append_path(fonts_path)
end
end
end
end
FontAwesome::Sass.load!