我有一个 Ruby on Rails 应用程序。对于我的观点,我正在使用 react-rails gem。我想通过 Google PageSpeed 提高页面速度。我的主要问题是Remove Render-Blocking JavaScript所以我在我的 javascript_include_tag 辅助方法中添加了 async: true 。然后,当我刷新站点时,我有空白的白色窗口浏览器,其中包含控制台内的这些消息:
ReferenceError: $ is not defined
$(document).ready(ready);
ReferenceError: jQuery is not defined
}(jQuery);
ReferenceError: jQuery is not defined
})( jQuery );
ReferenceError: React is not defined
this.About = React.createClass({
我的 applicaton.js 文件:
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap-sprockets
//= require react
//= require react_ujs
//= require semantic-ui
//= require components
//= reqiore custom
//= require_tree .
var ready;
ready = function() {
};
$(document).ready(ready);
$(document).on('page:load', ready);
我需要做什么才能删除阻塞的javascript?