我想使用像fancybox或color box这样的lightbox gem。两个gem都要求在application.css中添加这一行
*= require colorbox-rails
问题就在这里。我只有application.css.scss文件。我所有的css文件都是scss文件。我在application.css.scss中有导入语句,但没有*=require语句。添加上一行将导致错误:
“*”后的CSS无效:应为"{",为"=require colorb...“
下面是完整的application.css.scss
@import "bootstrap";
@import "welcome";
@import "sessions";
@import "users";
*= require colorbox-rails
发布于 2014-10-03 07:42:17
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";
https://stackoverflow.com/questions/26171159
复制相似问题