我有一个我正在尝试使用 mina 部署的 rails 4 应用程序。当我运行mina deploy
它时,它在资产预编译步骤中失败并以状态 19 退出。这是它吐出的错误:
rake aborted!
Invalid CSS after " *": expected "{", was "= require found..."
(in /var/www/someapp/tmp/build-139204594512190/app/assets/stylesheets/application.css)
(sass):15
所以我可以清楚地看到css文件和尝试的预编译可能有问题。在我尝试修复问题之前,我想确保文件有问题,所以我运行了rake assets:precompile
. 瞧,没有错误,一切都进行得很好。我想这可能是 dev 的配置方式与生产方式之间的差异,所以我备份了我的 development.rb 文件,复制了 production.rb 并将其重命名为 development.rb 并再次尝试并成功了。因此,如果我从 rake 运行命令,它可以工作,但如果 mina 在部署期间尝试该命令,它会失败。
我真的不知道如何处理这个问题。下面是 application.css 文件,给出错误的行是*= require foundation_and_overrides
/* * 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_self
*= require_tree .
*/
*= require foundation_and_overrides
@font-face {
font-family: 'relay-medium';
src: url('<%= asset_path("relay-medium.ttf") %>');
font-weight: normal;
font-style: normal;
}
感谢您的帮助!