Skip to content

Consider retaining existing prerequisites for assets:precompile #680

@toastercup

Description

@toastercup

Greetings! I'm seeking clarification on logic (lib/tasks/assets.rake#L46) that's clearing the prerequisites of the assets:precompile task. Here's what the offending bits look like:

Rake::Task["assets:precompile"]
  .clear_prerequisites
  .enhance([:environment, "react_on_rails:assets:compile_environment"])
  .enhance do
    Rake::Task["react_on_rails:assets:symlink_non_digested_assets"].invoke
    Rake::Task["react_on_rails:assets:delete_broken_symlinks"].invoke
  end

I believe this works well for most setups, but in our case, we're using bower-rails, which adds bower:before_precompile as a prerequisite for this task. react_on_rails clears bower-rails's prerequisites as a result of this line.

First, I'd like to understand why react_on_rails chose to do this - perhaps it's necessary. If it's unnecessary, I'd like to submit a Pull Request to remove it so existing prerequisites can be executed unhindered. I dug around in the repo's history to see if I could glean a reason for its existence - it looks like the original incarnation did not clear_prerequisites. The only documentation about the introduction of this change is in this review, but I don't fully understand the reasoning nor can I find the documentation the comment mentions.

I'm sure I could force bower-rails to load last, so that it adds its prerequisites last, but I feel this is a cleaner solution, and would save others the extra step. Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions