-
-
Save timriley/b6f46ba2000f1983356c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dir["#{Rails.root}/app/*/**"].each do |dir| | |
case File.basename(dir) | |
when 'assets' | |
Dir["#{dir}/*"].each do |assets_dir| | |
Rails.application.config.assets.paths << assets_dir | |
Dir["#{assets_dir}/*"].each do |asset| | |
parts = File.basename(asset).split('.') | |
name = "#{parts.first}.#{parts.second}" | |
Rails.application.config.assets.precompile += [name] | |
end | |
end | |
when 'views' | |
ActionController::Base.append_view_path dir.to_s | |
when 'helpers' | |
Rails.application.config.helpers_paths << dir.to_s | |
ActiveSupport::Dependencies.autoload_paths << dir.to_s | |
else | |
ActiveSupport::Dependencies.autoload_paths << dir.to_s | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Scott's comment:
I have been playing around with this idea in a small side project application I've been working on. By adding this file into config/initializers it allows you to structure your application grouped by feature or any way you want, eg: