0

rails3 앱에서 스타일 시트를 주문하려고하지만 * stylesheet_link_tag * 도우미를 사용하여 반복되는 라인 문제가 있습니다. 응용 프로그램/자산/스타일/폴더의CSS는 stylesheet_link_tag를 사용하여 반복합니다.

<link href="/assets/reset.css?body=1" media="screen" rel="stylesheet" type="text/css" /> 
<link href="/assets/application.css?body=1" media="screen" rel="stylesheet" type="text/css" /> 
<link href="/assets/event_calendar.css?body=1" media="screen" rel="stylesheet" type="text/css" /> 
<link href="/assets/reset.css?body=1" media="screen" rel="stylesheet" type="text/css" /> 
<link href="/assets/event_calendar.css?body=1" media="screen" rel="stylesheet" type="text/css" /> 

내용 :

calendar (master *)$ ls app/assets/stylesheets/ 
application.css  event_calendar.css reset.css 
생성 된 소스 코드에서

<%= stylesheet_link_tag :reset, :application, :event_calendar, :cache => false %> 

응용 프로그램/뷰/레이아웃/application.html.erb에서

* javascript_include_tag * helper를 사용하면 같은 종류의 문제가 나타납니다. 둘 다 관련 될 수 있다고 생각합니다. 당신이 자산 파이프 라인을 사용하는 경우

답변

2

가 에게 이
/* 
* 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_tree . 
*/ 

는이 주석 사실에 속지 것은이 될 것입니다하지 마 ... 등의 내부 선이 좋아하는이 있어야한다는 application.css을 포함해야합니다 처리되며, require_tree . 명령으로 인해 동일한 디렉토리에 모든 파일을 자동으로 포함합니다. 먼저 와서 당신의 reset.css을해야하는 경우가 application.css 내에서 순서를 지정할 수 있습니다

<%= stylesheet_link_tag :application, :cache => false %> 

그냥 넣어

...

*= require reset 
*= require_self 
*= require_tree . 
관련 문제