【发布时间】:2023-03-20 21:14:01
【问题描述】:
我是 ruby 新手,我的代码如下所示:这是正确的吗?我的 boostrap 没有加载..
所以application.scss
//= require .
//= require_self
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap
//= require_tree .
@import "bootstrap-sprockets";
@import "bootstrap";
而 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 vendor/assets/javascripts of plugins, if any, 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
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap-sprockets
//= require_tree .
感谢您的任何解释!
【问题讨论】:
-
那些
// require行不属于application.scss。无论如何,这些都是 JavaScript 清单行。 -
是
*=吗?在 scss 文件中? -
将
application.css更改为application.scss后,您必须使用Sass@import语句,而不是Rails 在资产清单文件中提供的默认CSS 注释语法。 -
不客气。我知道它可能不能解决你的问题,但至少我可以教你。 :)
-
@ChrisPeters 也许你有解决这个问题的办法? stackoverflow.com/questions/31189115/…
标签: javascript ruby-on-rails ruby twitter-bootstrap