Конвейер активов не генерирует правильные URL-адреса изображений - отсутствует путь к активу - PullRequest
0 голосов
/ 05 марта 2012

Я нахожусь на пути обновления моего приложения с Rails 3.0 до 3.1.3 (до того, как я обновился с 2.3). Теперь я хочу включить конвейер активов.

Я переместил свои таблицы стилей и теперь мой файл манифеста выглядит так

app.scss

@import "base";

_base.scss

.drawTrack {
    background-image: image-url('buttons/edit-20.png') !important;
}

в полученном css отсутствует путь к активу

app.css

.drawTrack {
  background-image: url('/buttons/edit-20.png') !important; 
}    

в моем Gemfile у меня есть

group :assets do
  gem 'sprockets'
  gem 'sass-rails'
  gem 'coffee-rails'
  gem 'compass-rails'
  gem 'uglifier', '>= 1.0.3'
end

application.rb

config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'

# Precompile *all* assets, except those that start with underscore
config.assets.precompile << /(^[^_\/]|\/[^_])[^\/]*$/
config.prefix = 'assets'

development.rb

# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true

Ранее я использовал jammit, но теперь я удалил драгоценный камень.

может быть связано. запрос /assets/index.js возвращает мне правильный файл javascript, однако сгенерированный путь /assets/index.js?body=1 возвращает мне пустой javascript.

ТНХ

1 Ответ

0 голосов
/ 06 марта 2012

Нашел ответ сам, пришлось обновить application.rb и заменить строку компоновщика на

# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require *Rails.groups(:assets => %w(development test))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end
...