css - 耙 Assets :precompile gives no erros but mina deploy fails on running the same command

标签 css deployment ruby-on-rails-4 sass mina

我有一个 Rails 4 应用程序,我正尝试使用 mina 进行部署。当我运行 mina deploy 时,它在 Assets 预编译步骤失败并以状态 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;                                                                                                                                                           
}  

感谢您的帮助!

最佳答案

并且通过将最后一个 *= require foundation_and_overrides 移动到注释 block 中来解决问题。

关于css - 耙 Assets :precompile gives no erros but mina deploy fails on running the same command,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21683011/

相关文章:

jquery - 幻灯片处于事件状态时使用 css 隐藏页脚

java - 如何通过单击 Windows 上的图标来运行 Java 程序?

ruby-on-rails - vzaar 上的视频未更新

css - 基础样式未按预期工作

javascript - 如何在div中对齐文本和图像垂直居中

html - SVG 图标在调整大小时未正确呈现

libraries - Qt 通用错误消息

ruby-on-rails - 使用 mongoid 更新数组字段的值

html - float div 在 IE7 中扩展到 100%

deployment - 如何避免 glassfish 部署所有以前的项目?