Ruby on rails 有没有一种方法可以包含所有';在/assets/javascripts中是什么?

Ruby on rails 有没有一种方法可以包含所有';在/assets/javascripts中是什么?,ruby-on-rails,include,Ruby On Rails,Include,正如罐头上写的。看起来像是javascript\u include\u标记:all包含/assets/all.js,而不是全部 有没有一种方法可以只包含其中的所有内容以及所有子文件夹?为什么不使用默认生成的application.js /app/assets/javascripts/application.js // This is a manifest file that'll be compiled into application.js, which will include all th

正如罐头上写的。看起来像是
javascript\u include\u标记:all
包含
/assets/all.js
,而不是全部


有没有一种方法可以只包含其中的所有内容以及所有子文件夹?

为什么不使用默认生成的
application.js

/app/assets/javascripts/application.js

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
注意最后一行:
/=require\u tree.
应该包括所有javascript

/app/view/layouts/application.html.erb

<%= javascript_include_tag "application" %>

require_tree指令告诉链轮递归地包含所有 将指定目录中的JavaScript文件导入输出。这些 必须相对于清单文件指定路径。你也可以 使用包含所有JavaScript的require_目录指令 文件只在指定的目录中,没有递归


为什么不使用默认生成的
application.js

/app/assets/javascripts/application.js

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
注意最后一行:
/=require\u tree.
应该包括所有javascript

/app/view/layouts/application.html.erb

<%= javascript_include_tag "application" %>

require_tree指令告诉链轮递归地包含所有 将指定目录中的JavaScript文件导入输出。这些 必须相对于清单文件指定路径。你也可以 使用包含所有JavaScript的require_目录指令 文件只在指定的目录中,没有递归


是的,这实际上是资产管道的主要目的之一。使用清单。是的,这实际上是资产管道的主要用途之一。使用清单。