I have a small Sinatra application, including this module:
module Sprockets module Helpers def asset_path(source) "/assets/#{Environment.instance.find_asset(source).digest_path}" end def sprockets Environment.instance.call(env) end end class << self def precompile dir = 'public/assets' FileUtils.rm_rf(dir, secure: true) ::Sprockets::StaticCompiler.new(Environment.instance, 'public/assets', [/\.(png|jpg)$/, /^(application|ie)\.(css|js)$/]).compile end end class Environment < ::Sprockets::Environment include Singleton def initialize super %w[app lib vendor].each do |dir| %w[images javascripts stylesheets].each do |type| path = File.join(root, dir, 'assets', type) append_path(path) if File.exist?(path) end end js_compressor = Uglifier.new css_compressor = YUI::CssCompressor.new context_class.instance_eval do include Helpers end end end end
and with the following definition:
get('/assets/*') do sprockets
Everything works fine, assets are loaded and displayed on the local machine using pow . But on Heroku, no assets are uploaded, the server simply returns 404 for each asset file.
source share