Sprocketsを使用してRails 3.2でこれを行う「デフォルトの」方法は、Sprocketsマニフェストコードを含むapplication.css(application.css.scssではなく)というファイルを持つことだと思います。これは次のようになります...
application.css(アプリ/資産/スタイルシート)
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require main_scss_file
*/
1は、自身の内部にコンテンツを追加しrequire_selfする必要があり、少なくとも2行があるはずですあなたのメインのscssファイルへの参照であるsome_other_fileが必要です。rakeアセットのデフォルトの動作:プリコンパイルはapplication.jsとアプリケーションcssをコンパイルすることです。
production.rbはRail生成プログラムによって生成されましたapplication.cssはデフォルト。 (設定/環境)
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w(search.js)
config.assets.precompile += %w(home.js)
application.erb
<%= stylesheet_link_tag 'application' %>
それなら、私はなぜそれもやっているのか分かりません。私は 'application'を試してみましたが、私の質問によると、application.cssに変わりました:( – comebacknader
それは私が意味するのですが、なぜ動作しないのですか?アセットパイプラインはscssファイルから 'application.css' – x1a4