Wil*_*lor 11 css compilation ruby-on-rails heroku precompile
我希望这不是一个重复的问题; 我在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
Run Code Online (Sandbox Code Playgroud)
尝试解决方案
我已经搜索并删除了在../stylesheets/adminsite/目录中@ font-face之前的每个"*/"实例.相同的问题和结果.
我试过设置:
config.assets.compile = true
Run Code Online (Sandbox Code Playgroud)
......同样的问题
编辑
这是我的application.css(不是应用程序级别1,而是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
*/
Run Code Online (Sandbox Code Playgroud)
通过删除和重新整理,我发现了
*= require ./global/plugins/font-awesome/scss/font-awesome
Run Code Online (Sandbox Code Playgroud)
那个从列表底部开始的3个,导致它失败了.我现在可以在本地运行
rake assets:precompile --trace RAILS_ENV=production
Run Code Online (Sandbox Code Playgroud)
但是我无法使用推送到heroku
git push herokunb newbeta:master
Run Code Online (Sandbox Code Playgroud)
解决了:
这是字体真棒CSS.删除它需要修复它.这个问题似乎没有解决,只是由于我自己的git错误.
小智 11
即使你找到了解决问题的方法,我也会分享我的解决方案,因为我遇到了同样的问题而且很难调试它.
你可能会使用rails3.2,sass-rails3.2和font-awesome-sass4.1.
事实证明,rails 3.2使用sass-rails 3.2.6,这取决于sass> = 3.1.但是,看起来sass3.1与font-awesome 4.1不兼容,所以我明确地将sassgem 设置为在我的Gemfile上使用3.2版.
gem 'sass-rails', '~> 3.2.6'
gem 'sass', '~> 3.2.0'
Run Code Online (Sandbox Code Playgroud)
希望这有助于某人!;)
解决方案
造成问题的文件是 font Awesome CSS。从 application.css 的“require”行中删除它可以让预编译工作。
这样做的方法是首先删除所有预编译的 require 字段,表明它可以编译,然后慢慢地将 require 字段添加回来,看看它在哪里损坏。
(感谢所有帮助解决这个问题的人。)