Matthew Bellantoni

A Rails Rake Task to Dump The Asset Path

rails

Here's a rake task that dumps out the current asset path.  For those who don't know, the asset pipeline is a major (cool!) new feature in Rails 3.1.  I've been working on some gems that provide assets (javascript and stylesheets) and I've gotten tired of going to the console to look at the asset path.

Here's the code:

1
2
3
4
5
6
7
8
namespace :assets do
  desc "Display asset path"
  task paths: :environment do
    Rails.application.config.assets.paths.each do |path|
      puts path
    end
  end
end

Also available as a gist.