lib/chive/engine.rb in chive-0.1.1 vs lib/chive/engine.rb in chive-0.2.0

- old
+ new

@@ -2,11 +2,23 @@ module Chive class Engine < ::Rails::Engine isolate_namespace Chive - initializer 'chive.assets' do |app| + initializer 'chive.assets.precompile' do |app| app.config.assets.precompile += fetch_asset_names + end + + # Enhance the assets:precompile task with the chive:public_assets task to + # ensure that the main app can access this engine's assets in production. + rake_tasks do + load Chive::Engine.root.join('lib', 'tasks', 'chive_tasks.rake') + + if Rake::Task.task_defined?('assets:precompile') + Rake::Task['assets:precompile'].enhance do + Rake::Task['chive:public_assets'].invoke + end + end end private def fetch_asset_names