我希望这不是一个重复的问题;我在 SO 上尝试了其他解决方案但没有效果
将我的应用程序推送到 Heroku 时,推送失败,因为 application.css 无法编译。
我的终端输出:
Running: rake assets:precompile
rake aborted!
Sass::SyntaxError: Invalid CSS after " */": expected selector, was "@font-face"
(in /tmp/build_17e92975-ae8d-446f-8678-110eeeccfb64/app/assets/stylesheets/adminsite/application.css)
(sass):1845
尝试解决
我已经搜索并删除了 ../stylesheets/adminsite/目录中 @font-face 之前的每个“*/”实例。同样的问题和结果。
我试过设置:
config.assets.compile = true
...同样的问题
编辑
这是我的 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, 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 top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require jquery.ui.all
*= require_self
*= require normalize
*= require ./global/plugins/bootstrap/css/bootstrap
*= require ./global/plugins/uniform/css/uniform.default
*= require ./global/plugins/bootstrap-switch/css/bootstrap-switch
*= require ./global/css/components
*= require ./global/css/plugins
*= require ./global/plugins/simple-line-icons/simple-line-icons
*= require ./admin/layout/css/layout
*= require ./admin/layout/css/themes/light2
*= require ./admin/layout/css/custom
*/
通过删除和重新编译,我发现
*= require ./global/plugins/font-awesome/scss/font-awesome
那是该列表底部的 3 个,导致它失败。我现在可以在本地运行
rake assets:precompile --trace RAILS_ENV=production
但我无法使用
推送到 herokugit push herokunb newbeta:master
已解决:
这是很棒的字体 CSS。从 require 中删除它修复它。这个问题似乎没有解决只是因为我自己在 git 上的错误。
最佳答案
即使您找到了修复它的方法,我也会分享我的解决方案,因为我遇到了同样的问题并且调试起来有点困难。
您可能正在使用 rails
3.2、sass-rails
3.2 和 font-awesome-sass
4.1。
原来rails
3.2使用的是sass-rails
3.2.6,它依赖于sass
>= 3.1。但是,看起来 sass
3.1 与 font-awesome
4.1 不兼容,所以我明确地设置了 sass
gem 在我的 Gemfile 上使用 3.2 版。
gem 'sass-rails', '~> 3.2.6'
gem 'sass', '~> 3.2.0'
希望这对某人有帮助! ;)
关于css - rake Assets :预编译抛出 Sass::SyntaxError: "*/"后无效的 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25722267/