ローカルホストでは、Compassは完全に機能します。screen.scss
うまくロードcompass/reset
します。ですprint.scss
。
Herokuでは、screen.scssは引き続き機能しますが、次のprint.scss
エラーが発生します。
Error compiling CSS asset
Sass::SyntaxError: File to import not found or unreadable: compass/reset.
Load path: Sass::Rails::Importer(/app/app/assets/stylesheets/print.scss)
(in /app/app/assets/stylesheets/print.scss)
/app/app/assets/stylesheets/print.scss:1
なんで?どうすれば修正できますか?
関連ファイルからの関連行...
Gemfile:
gem "compass"
gem "pg"
gem "sass"
gem "sass-rails"
gem "haml"
gem "haml-rails"
gem "susy"
# gem "thin"
gem "unicorn"
gem "pdfkit"
gem "wkhtmltopdf-binary"
group :assets do
gem "sass-rails"
gem "coffee-rails"
gem "compass-rails"
gem "compass-susy-plugin"
end
config / application.rb:
if defined?(Bundler)
Bundler.require *Rails.groups(:assets => %w(development test))
end
module Testivate
class Application < Rails::Application
config.assets.enabled = true
config.assets.paths << "#{Rails.root}/app/assets/fonts"
config.assets.initialize_on_precompile = false
config.assets.version = '1.0'
config.middleware.use "PDFKit::Middleware", :print_media_type => true
end
end
/config/environments/production.rb:
Testivate::Application.configure do
config.cache_classes = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_assets = true
config.assets.precompile += %w( .svg .eot .woff .ttf )
config.assets.compress = true
config.assets.compile = true
config.assets.digest = true
end
/app/assets/stylsheets/screen.scss(最初の行):
@import "compass/reset";
/app/assets/stylesheets/print.scss(最初の行):
@import "compass/reset";
/app/assets/stylesheets/application.css:
/*
*= require_self
*= require jquery.ui.core
*= require screen
*/
/app/views/reviews/print.html(からコンパイルされたものprint.html.haml
):
<head>
<link href="/assets/print.css" media="print, screen, projection" rel="stylesheet" type="text/css" />
</head>
/app/views/reviews/show.html(からコンパイルされたものshow.html.haml
):
<head>
<link href="/assets/application.css" media="screen" rel="stylesheet" type="text/css" />
</head>