Josh answered me here: https://github.com/sstephenson/sprockets/issues/151
Assets = Sprockets::Environment.new(Rails.root) do |env| assets = ["javascripts", "stylesheets", "images", "fonts"] paths = ["app/assets/", "lib/assets/", "vendor/assets/" ].map{|p| assets.map{|f| "#{p}#{f}" } }.flatten paths.each{ |path| env.append_path path } env.static_root = Rails.root.join("public", "assets") end
So, basically, I have a summary task for precompiling assets:
namespace :assets do task :precompile => :environment do Assets.precompile(*Rails.application.config.assets.precompile) end end
My problem was mainly in knowing how to request these assets. The answer is pretty simple:
Assets['application.js'].digest
Having a fingerprint makes it easy to get a file name.
I created helpers to include these resources: sprockets_include_tag and sprockets_image_tag .
Done deal.
(Although right now I cannot use these helpers in my style sheets (style.css.scss.erb))
Robin source share