简体   繁体   English

Rails资产:加载顺序

[英]Rails Assets: Load order

I am attempting to use a package called angular-dragula which is available through bower as well as a gem. 我正在尝试使用一个名为angular-dragula的软件包,该软件包可通过凉亭和宝石获得。 I need the package to load after the DOM loads, in the body (not the head), but when I include the file in application.js with //=require angular-dragula it loads before the DOM, and results in an error. 我需要封装中的DOM加载加载,在主体(未头),但是当我在文件中包含application.js//=require angular-dragula它的DOM之前加载,并且在一个错误的结果。

Is there a way to control this? 有办法控制吗? When I try to include it in the .html with <script src="bower_components/angular-dragula/angular-dragula.js"></script> , I get a 404 error. 当我尝试使用<script src="bower_components/angular-dragula/angular-dragula.js"></script>将其包含在.html时,出现404错误。

https://github.com/bevacqua/angular-dragula https://github.com/bevacqua/angular-dragula

app/views/layouts/application.html.erb的正文中,添加以下内容:

<%= javascript_include_tag "angular-dragula" %>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM