Add a assets:precompile:check task #2804

Closed
rhulse opened this Issue Sep 1, 2011 · 5 comments

4 participants

@rhulse

I've been upgrading an app from 3.0, and got caught out in a couple of places with files not moved into the pipeline folders, and in one case a CSS image file was missing from a third party library.

I was running assets:precompile to catch any missing files (deleting the result), but it would be really handy to have a task that did a dry run. It would not write any files and just output the names of referenced files that are missing from the pipeline.

@vijaydev
Ruby on Rails member

A dry-run option to the assets:precompile task is better than a new task, I think.

@rhulse

I agree.

Such a task would alert users to files referenced in manifests or in assets.precompile, but thinking about it some more it doesn't solve the issue of references to files from views such as individual files (added to precompile) or images.

That is still going to be the domain of testing unless the test mode can walk through all the views looking for missing files.

Ref: http://stackoverflow.com/questions/7278703/how-do-you-catch-errors-in-the-rails-asset-pipeline-before-production

@rhulse

Thinking about this some more, a --dry-run option is only going to find assets in manifests or their dependencies. The task fails if it cannot find an asset anyway.

The thing that is more likely to catch you out is stuff in views, which is a bit more tricky to find and check.

@davidjrice

I don't think this is really something that is feasible to do 100%. It's only going to be an issue with upgrading old applications to Rails 3.1. As for any new applications, just don't hardcode asset references, it's the law!

Probably the better place for something like this would be the rails_upgrade project.

I'd say this issue could be closed.

@guilleiguaran
Ruby on Rails member

Closing this here since Sprockets integration was extracted from Rails edge and this couldn't be done in 3-2-stable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment