2014-02-13 178 views
-1

我剛開始我的第一個紅寶石應用程序。紅寶石軌道和資產

我複製需要我的應用程序的資產文件夾中的CSS和JS文件,當我運行應用程序加載到頁面的所有CSS和JS,我不希望出現這種情況

我的看法很簡單

hello 

我application.css只是評論

/* 
* This is a manifest file that'll be compiled into application.css, which will include all the files 
* listed below. 
* 
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 
* 
* 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_tree . 
*/ 

爲什麼所有資產裝入? 我可以「禁用」這個嗎?

我要的是定義文件(CSS,JS)僅與所需specifif頁面

+2

推薦閱讀:http:// guides。 rubyonrails.org/asset_pipeline.html – givanse

回答

3

有特殊的評論特定的順序和加載JS視圖文件需要。 Rails的預處理器解釋它並插入你的文件。

*= require_self 
*= require_tree . 

閱讀The Asset Pipeline。 2.4清單文件和指令。

+0

謝謝我剛開始 – ntan