문제

부트 스트랩-스스 레일을 사용하고 있습니다 이 문제 그리고 Rails 프로젝트를 생산 모드로 실행하면 3x 404 오류가 발생합니다.

GET http://localhost:3000/assets/twitter/bootstrap/glyphicons-halflings-regular.woff 404 (Not Found) assets/twitter/bootstrap/glyphicons-halflings-regular.woff:1
GET http://localhost:3000/assets/twitter/bootstrap/glyphicons-halflings-regular.ttf 404 (Not Found) assets/twitter/bootstrap/glyphicons-halflings-regular.ttf:1
GET http://localhost:3000/assets/twitter/bootstrap/glyphicons-halflings-regular.svg 404 (Not Found) 

Rake Assets : Precompile Rails_env = 프로덕션을 사용하여 결과로 정적 파일을 생성했습니다.

I, [2013-11-07T16:52:25.269370 #12948]  INFO -- : Writing myproject/public/assets/application-3517eb39b597107b3dbccbcbf4f0b3cc.js
I, [2013-11-07T16:52:25.315358 #12948]  INFO -- : Writing myproject/public/assets/application-1459bfe79a6477170658d53257e4a8fd.css
I, [2013-11-07T16:52:25.334356 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-8b1bdc16b9e098d67afebbf8d59fcea7.eot
I, [2013-11-07T16:52:25.345360 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-8d8305e5b6a807076d3ec68e2f190674.svg
I, [2013-11-07T16:52:25.357360 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-946071b70245967633bb3a774c60f3a3.ttf
I, [2013-11-07T16:52:25.367360 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-d7e2274ad1d940a0b2ce7480810ab223.woff
etc ...

이 3 개의 글꼴 파일을 제외한 모든 자산은 잘 작동합니다. 나는 하루 종일 검색했고 아무것도 찾지 못했습니다. Rails는이 3 개의 파일의 해시가없는 버전을 찾고있는 것 같습니다. 그러나 레이크는 해시로 생성합니다.

내 config/production.rb :

  config.cache_classes = true
  config.eager_load = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_assets = true
  config.assets.js_compressor = :uglifier
  config.assets.compile = false
  config.assets.digest = true
  config.assets.version = '1.0'
  config.log_level = :info
  config.i18n.fallbacks = true
  config.active_support.deprecation = :notify

편집하다

@font-face 변수를 무시하려고했지만 이전 변수를 제거하지 않는 것 같습니다.

@font-face {
  font-family: 'Glyphicons Halflings';
  src: asset-url('twitter/bootstrap/glyphicons-halflings-regular.eot',font);
  src: asset-url('twitter/bootstrap/glyphicons-halflings-regular.eot?#iefix',font) format('embedded-opentype'), asset-url('twitter/bootstrap/glyphicons-halflings-regular.woff',font) format('woff'), asset-url('twitter/bootstrap/glyphicons-halflings-regular.ttf',font) format('truetype'), asset-url('twitter/bootstrap/glyphicons-halflings-regular.svg#glyphicons-halflingsregular',font) format('svg');
}

이제 글리 피콘을로드했지만 여전히 3 배 404 개의 오류가 있습니다.

도움이 되었습니까?

해결책

Ok then.

I switched to https://github.com/thomas-mcdonald/bootstrap-sass . Pretty same bootstrap version and no problem with it.

EDIT UPDATE

bootstrap-sass has been updated. You need to make some changes as explained on github page if you still have 404 errors.

다른 팁

나는 같은 문제가 있었다. 내가 추가해야한다는 것이 밝혀졌습니다 @import "bootstrap-sprockets" 에 추가 @import "bootstrap" 내부에 application.css.sass.

웹 서버에 마임 타입을 추가하십시오.

Woff 파일을 제공하는 방법을 정의해야합니다.

IIS의 경우 IIS로 이동하여 광산 유형 창을 열십시오.

추가 및 입력 "woff"첫 번째 입력 상자와"응용 프로그램/x-font-woff"두 번째 상자의 경우

그런 다음 다른 확장에 대해 반복하십시오

행운을 빕니다

글꼴 디렉토리는 자동으로 자산 디렉토리로 표시되지 않습니다. 설정하여 명시 적으로 추가해야합니다. config.assets.paths << Rails.root.join("app", "assets", "fonts") 에서 application.rb 파일.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top