Skip to content

Commit cebde5b

Browse files
committed
Automatically register assets for precompilation
1 parent c1b8690 commit cebde5b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lib/font/awesome/grunticon/rails.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,25 @@ module Font
44
module Awesome
55
module Grunticon
66
module Rails
7-
class Engine < ::Rails::Engine; end
7+
class Engine < ::Rails::Engine
8+
initializer "font-awesome-grunticon-rails.assets.precompile" do |app|
9+
{
10+
'javascripts' => '*.js',
11+
'stylesheets' => '*.css',
12+
'images' => '*.png',
13+
'images/png' => '*.png'
14+
}.each do |dir, glob|
15+
fulldir = ::File.expand_path("../../../../../vendor/assets/#{dir}", __FILE__)
16+
# puts "Checking #{fulldir} for #{glob}"
17+
::Dir.glob("#{fulldir}/#{glob}").map do |f|
18+
relative_path = f.sub("#{fulldir}/", '')
19+
relative_path = "png/#{relative_path}" if dir == 'images/png'
20+
# puts "Adding #{relative_path} to app.config.assets.precompile"
21+
app.config.assets.precompile += [ relative_path ]
22+
end
23+
end
24+
end
25+
end
826
end
927
end
1028
end

0 commit comments

Comments
 (0)