Rails无效的CSS错误

Rails无效的CSS错误

本文介绍了SASS Rails无效的CSS错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的Rails应用程序中使用但是我在我的fashion-portfolio.css.scss.erb文件中出现以下错误:

I'm trying to use http://startbootstrap.com/stylish-portfolio in my rails app however I'm getting the following error in my stylish-portfolio.css.scss.erb file:

ActionView::Template::Error (Invalid CSS after "body ": expected selector or at-rule, was "{"

这是我的css file:

This is my css file:

@import 'bootstrap'

/* Global Styles */

html,
body {
  height: 100%;
  width: 100%;
}

.vert-text {
  display: table-cell;
  vertical-align: middle;
  text-align: center;
}

.vert-text h1 {
  padding: 0;
  margin: 0;
  font-size: 4.5em;
  font-weight: 700;
}

...

推荐答案

我的猜测是你在 stylish-portfolio.css.scss.erb 文件中缺少分号,可能在尾部呃一个SCSS变量定义?

My guess is that you are missing a semicolon in the stylish-portfolio.css.scss.erb file, maybe after an SCSS variable definition?

我假设你基于此,也许你想要做一个 diff 之间,以确定发生了什么变化。

Here's the original CSS file I assume you are basing this on, maybe you want to do a diff between that and yours to determine what has changed.

编辑:在第一行之后是一个缺失的分号。 @import 语句

Yup, apparently there is a missing semicolon after the first line. The @import statement

@import 'bootstrap'

应改为

should instead be

@import 'bootstrap';

因为您正在使用 .scss 扩展程序。如果您使用 .sass 扩展名,则可以省略分号。

since you are using the .scss extension. You can omit the semi-colon if you are using the .sass extension.

这篇关于SASS Rails无效的CSS错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 04:49