내 레일 (4.0.0) 프로젝트에서 bootstrap-sass (3.1.0.2) 및 sass-rails (4.0.1)를 사용하려고합니다.Rails가있는 부트 스트랩 Sass 4
내 application.css.scss 파일은 다음과 같습니다 :
/*
* 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 font-awesome
*= require_tree .
*/
내 bootstrap_and_overrides.css.scss 파일이 스타일 시트 폴더에 있으며 다음과 같습니다
@import "bootstrap";
나는 검사를 페이지가 다음과 같이 시도해보십시오.
<div class="container">
<h2>test terms</h2>
<h1>h1. Bootstrap heading <small>Secondary text</small></h1>
<p class="bg-primary">.dfd..</p>
<p class="bg-success">..sdfas.</p>
<p class="bg-info">..sdfs.</p>
<p class="bg-warning">.asdf..</p>
<p class="bg-danger">.adf..</p>
<p>test terms</p>
<button type="button" class="btn btn-primary">Default</button>
</div>
<button type="button" class="btn btn-info">Info</button>
서버를 시작하고 페이지를 방문하면 부트 스트랩 스타일링없이 일반 텍스트로 표시됩니다.
어떻게해야 할 지에 대한 아이디어는 인정 될 것입니다. 여기에있는 몇몇 사람들이 보석을 사용하지 않는 것 같습니다. 이 접근 방식에 대한 이유가 있습니까? 매우 감사합니다!
# Gemfile
gem 'bootstrap-sass'
# application.css.scss
/*
*= require_self
*= require vendor
* require_tree .
*/
@import "bootstrap";
// Import individual stylesheet
@import "base"; /* app/assets/stylesheets/base.css.scss */
@import "events"; /* app/assets/stylesheets/events.css.scss */
require_tree .
을 사용하지 않고 대신 개별 CSS 파일 (base
, events
를) 가져 오기 :
HTML 페이지의 출처를 게시 할 수 있습니까? 몇 가지 정보가있을 수 있습니다. 가능하면 레이아웃 파일 – Muntasim
'bundle '을 실행 했습니까? –
application.css.scss에서 필요한 부트 스트랩을 시도 했습니까? 또는, conflig/application.rb 내부에 요구 사항을 추가해보십시오. (두 번째 방법으로 작업했는데 첫 번째 오류는 반환했습니다.) –