Skip to content

Commit

Permalink
Add assets precompile hook
Browse files Browse the repository at this point in the history
Finishes #11
  • Loading branch information
Jonathan Jackson and Pavel Pravosud authored and rwz committed Dec 5, 2014
1 parent ac2613f commit 727b353
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/ember-cli/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,15 @@ def which(cmd)

nil
end

def override_assets_precompile_task!
Rake.application.instance_eval do
@tasks["assets:precompile:original"] = @tasks.delete("assets:precompile")
Rake::Task.define_task "assets:precompile", %i[assets precompile] => :environment do
EmberCLI.compile!
Rake::Task["assets:precompile:original"].execute
end
end
end
end
end
4 changes: 4 additions & 0 deletions lib/ember-cli/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class Railtie < Rails::Railtie
EmberCLI.enable! if non_production?
end

rake_tasks do
require "ember-cli/rake_task"
end

def non_production?
!Rails.env.production? && Rails.configuration.consider_all_requests_local
end
Expand Down
3 changes: 3 additions & 0 deletions lib/ember-cli/rake_task.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require "sprockets/rails/task"

EmberCLI::Helpers.override_assets_precompile_task!

0 comments on commit 727b353

Please sign in to comment.