我希望这不是一个重复的问题;我已经尝试了 Stack Overflow 上的其他解决方案,但没有效果。
当将我的应用程序推送到 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文件(不是应用程序级别的文件,而是在adminsite目录中失败的文件)
/*
* 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
那个列表从底部算起排名第三的内容导致了它的失败。现在我可以在本地运行。
rake assets:precompile --trace RAILS_ENV=production
但是我无法使用 heroku 进行推送。
git push herokunb newbeta:master
已解决:
问题出在font awesome的CSS上。移除require中的相关内容即可解决。由于我在使用git时犯了自己的错误,导致这个问题看起来一直没有被解决。