I like to keep my assets highly organized, however, I am running into an issue with precompile. It is not picking up the sub directories. Here are the paths:
assets
>fonts
>images
>>backgrounds
>>home
>>icons
Everything works on dev, but prod = no go. In my prod environment I already do:
config.assets.enabled = true
config.assets.compile = true
config.assets.precompile += ['*.js', '*.ico', '*.png', '*.jpg']
config.assets.initialize_on_precompile = true
And I am currently running the following function in my application.rb file:
# Add All Asset Pipeline Sub Folders
Dir.glob("#{Rails.root}/app/assets/images/**/").each do |path|
config.assets.paths << path
end
This is what I have been working with no, with not much luck. I was hoping to dynamically pick up all directories created/changed etc with few lines of code so I do not have to add them one by one.....
# Add All Asset Pipeline Sub Folders
Dir.glob("#{Rails.root}/app/assets/images/**/").each do |path|
config.assets.paths << path
config.assets.precompile += ['#{path}/*']
end
Thoughts?
Updated Solution:
I ended up going with the following in my production rb:
config.assets.precompile += ['*.js', '*.ico', '*.png', '*.jpg']
config.assets.precompile += [ Dir["#{Rails.root}/app/assets/images/**/*"].reject {|fn| File.directory?(fn) } ]