0

enter image description here

Relevante Teil GemFile laden:

enter image description hereRails mit Bootstrap (unter Windows) - leer application.css Datei und Styling wird nicht


Bundle installieren:

enter image description here


Und immer noch keine Wirkung:

enter image description here


Von \ app \ views \ Layouts \ application.html.erb:

<%= stylesheet_link_tag "application", :media => "all" %> 
 
<%= javascript_include_tag "application" %>

application.js:

// This is a manifest file that'll be compiled into application.js, which will include all the files 
 
// listed below. 
 
// 
 
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 
 
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 
 
// 
 
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 
 
// compiled file. JavaScript code in this file should be added after the last require_* statement. 
 
// 
 
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 
 
// about supported directives. 
 
// 
 
//= require jquery 
 
//= require jquery_ujs 
 
//= require twitter/bootstrap 
 
//= require turbolinks 
 
//= require_tree .

Wie kann ich Bootstrap Styling laden?

+0

Darf ich wissen, was alle Dateien in Ihrem App/Assets/Stylesheets-Ordner sind? – Saran

Antwort

0

Scheint zu fehlen, Bootstrap-Stile zu importieren. Um dies zu lösen nach dem bootstrap-sassdocumentation sollten Sie:

Import Bootstrap Arten in app/assets/stylesheets/application.scss

// "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables" 
@import "bootstrap-sprockets"; 
@import "bootstrap"; 

Bootstrap-Zahnräder müssen für die Symbol-Schriftarten vor Bootstrap importiert werden, um zu arbeiten.

Stellen Sie sicher, dass die Datei die Erweiterung .scss (oder .sass für die Sass-Syntax) hat. Wenn Sie gerade eine neue Rails-App generiert haben, wird stattdessen eine .css-Datei mit

0
gesendet.

Zuerst sollten Sie entscheiden, welches Juwel zu verwenden, twitter-bootstrap-rails oder bootstrap-sass, nicht beide.

Angenommen, Sie bootstrap-sass verwenden Sie dann in Ihrem application.js

//= require bootstrap-sprockets

//= require twitter/bootstrap

nicht und dann

hinzufügen sollte
@import "bootstrap-sprockets"; 
@import "bootstrap"; 

auf Ihre app/assets/stylesheets/application.scss wie R. Sierra sagte.

Jetzt sollte Ihre App gut zu gehen sein!

Verwandte Themen