首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >application.css.scss中的Require语句

application.css.scss中的Require语句
EN

Stack Overflow用户
提问于 2014-10-03 07:24:42
回答 1查看 40.7K关注 0票数 33

我想使用像fancybox或color box这样的lightbox gem。两个gem都要求在application.css中添加这一行

代码语言:javascript
复制
 *= require colorbox-rails

问题就在这里。我只有application.css.scss文件。我所有的css文件都是scss文件。我在application.css.scss中有导入语句,但没有*=require语句。添加上一行将导致错误:

“*”后的CSS无效:应为"{",为"=require colorb...“

下面是完整的application.css.scss

代码语言:javascript
复制
@import "bootstrap";
@import "welcome";
@import "sessions";
@import "users";


*= require colorbox-rails
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-10-03 07:42:17

application.css.scssapplication.css也是一样的。只需将您的application.css重命名为application.css.scss

至于添加这一行,它需要在注释中位于顶部。如下所示:

代码语言:javascript
复制
/*
 * 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";
票数 59
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26171159

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档