【问题标题】:upgrading turbolinks leads the css to stop loading升级 turbolinks 导致 css 停止加载
【发布时间】:2017-02-07 08:29:42
【问题描述】:

我的 rails 应用程序停止加载 css 文件并返回如下错误:

".add_icon" failed to @extend ".fa-plus-circle".
The selector ".fa-plus-circle" was not found.
Use "@extend .fa-plus-circle !optional" if the extend should be able to fail.

我的 js 和 css 没有正确加载,根据建议,我只是尝试使用 gem 'jquery-turbolinks' 升级 turbo 链接

如果我从 js 中注释掉 gem 和 gem 文件,应用程序开始工作,但在没有页面刷新的情况下不会加载我的资源。

我不得不重新加载我的页面。

我的 js 看起来像:

//= require jquery.min
//= require jquery.turbolinks
//= require jquery_ujs
//= require turbolinks
//= require bootstrap.min
//= require common
//= require owl.carousel.min.js
//= require modernizr
//= require parallax
//= require toggle
//= require modernizr
// require_tree .

我的 css 文件:

* require_tree .
 *= require bootstrap.min
 *= require style
 *= require owl.carousel
 *= require owl.theme
 *= require font-awesome
 *= require refinery/formatting
 *= require refinery/theme
 *= require_self

【问题讨论】:

    标签: jquery css ruby-on-rails asset-pipeline turbolinks


    【解决方案1】:

    最近我在 turbolinks 上苦苦挣扎。我正在使用 Rails 5。我通过将此代码放在我的 xxx.coffee 文件中找到了解决方案:

    $(document).on 'turbolinks:load', -> 
     # Your code goes here
    

    如果你使用的是纯 js 而不是咖啡,试试这个:

    $(document).on('turbolinks:load', function() {
      # Your code goes here
    })
    

    同样,这取决于您使用的 Rails 版本。在 Rails 5 中,turbolinks 已被重新编写,并且不使用与以前版本相同的事件名称。

    抱歉,由于我没有足够的分数,我无法对您的问题发表评论,所以我在这里发布了答案。你能提供更多信息吗?您使用的是哪个 Rails 版本?你可以发送 Gemfile 吗?你完成包更新了吗?

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-01-08
      • 2021-04-23
      • 1970-01-01
      • 1970-01-01
      • 2012-05-25
      • 2015-07-14
      • 1970-01-01
      相关资源
      最近更新 更多