加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 在application.css.scss中的Require语句

发布时间:2020-12-16 20:42:04 所属栏目:百科 来源:网络整理
导读:我想使用灯箱宝石,如fancybox或彩盒.两个宝石要求在application.css中添加这一行 *= require colorbox-rails 这是问题.我只有application.css.scss文件.我所有的css文件都是scss文件.我在application.css.scss中有import语句,但没有* = require语句.添加上述
我想使用灯箱宝石,如fancybox或彩盒.两个宝石要求在application.css中添加这一行
*= require colorbox-rails

这是问题.我只有application.css.scss文件.我所有的css文件都是scss文件.我在application.css.scss中有import语句,但没有* = require语句.添加上述行会导致错误:

“*”后无效的CSS:expected“{”,was“= require colorb …”

这是完整的application.css.scss

@import "bootstrap";
@import "welcome";
@import "sessions";
@import "users";


*= require colorbox-rails

解决方法

application.css.scss或application.css是一样的.只需将你的application.css重命名为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 bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 *= require_self
 *= require colorbox-rails
 */

@import "bootstrap";
@import "welcome";
@import "sessions";
@import "users";

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读