0

コンパスでレールを使用しています。

コンパスなしでレールを使用する場合、レールにはコントローラーごとに css があり、そのコントローラーのビューにのみ関連するものを含みます。

コンパスで同じ動作を得ることができなかったため、コントローラーごとに個別のファイルではなく、大きなモノリシック ファイルが作成されました。

その問題を解決するための推奨されるアプローチは何ですか?

4

1 に答える 1

0

Rails (since 3.1) does create a css file per controller but it's only for practical code separation, all code assets get compiled into one master file per format (.css, .js..), and this is the best practice 90% of the time.

If you want to use this approach with SCSS or SASS code, just change the file extension to .css.scss or .css.sass (ie: mycontroller.css.scss)

If you want to separate the compiled files per controller (you probably don't need it, so i'd advise that you understand the asset pipeline before doing it), you'll have to implement the custom behavior yourself. take a look here http://guides.rubyonrails.org/asset_pipeline.html

于 2013-03-12T16:03:06.677 に答える