(sass):26096 如何修复 Rails 中的“Sass::SyntaxError: Invalid CSS after”错误
Posted
技术标签:
【中文标题】(sass):26096 如何修复 Rails 中的“Sass::SyntaxError: Invalid CSS after”错误【英文标题】:(sass):26096 How to fix 'Sass::SyntaxError: Invalid CSS after' error in Rails 【发布时间】:2019-07-03 14:40:07 【问题描述】:我在本地运行这个
rake assets:precompile --trace RAILS_ENV=production
红宝石:2.6.3
导轨:5.2.2
捆绑器:2.0.2
美洲狮:3.12.1
这是我的 CSS
application.css
* 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, or any plugin's
* vendor/assets/stylesheets directory 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 other CSS/SCSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/
*= require font-awesome.css
*= require bootstrap.css
*= require font-awesome.css
*= require lineicons.css
*= require mystyles.css
*= require styles.css
*= require weather-icons.css
错误日志
Sass::SyntaxError: Invalid CSS after "...ather-icons.css": expected "", was ""
(sass):26096
我希望在运行rake assets:precompile --trace RAILS_ENV=production
时成功
【问题讨论】:
【参考方案1】:我认为您应该将 application.css 重命名为 application.scss 并删除 require 树和 require self
【讨论】:
以上是关于(sass):26096 如何修复 Rails 中的“Sass::SyntaxError: Invalid CSS after”错误的主要内容,如果未能解决你的问题,请参考以下文章
如何让 Rails 3.1 默认使用 SASS (Over SCSS)?
在 Rails 布局中使用 Sass 的 Twitter Bootstrap