11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/generators/attributes_for/install_generator.rb', line 11
def inject_stylesheets
in_root do
{
"css" => {
require_string: " *= require font-awesome",
where: {before: %r{.*require_self}},
},
"css.scss" => {
require_string: "@import \"font-awesome\";",
where: {after: %r{\A}},
},
}.each do |extension, strategy|
file = "app/assets/stylesheets/application.#{extension}"
if File.exists?(Rails.root.join(file))
unless File.foreach(file).grep(/#{strategy[:require_string]}/).any?
inject_into_file file, strategy[:require_string] + "\n", strategy[:where]
end
end
end
end
end
|