Javascript 如何在 Rails 3.1 中包含供应商 js

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6447405/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 21:46:02  来源:igfitidea点击:

How to include vendor js in Rails 3.1

javascriptruby-on-railsruby-on-rails-3.1vendor

提问by Casper larsen

I have a js vendor script called Corners.jslocated in /vendor/assets/javascripts/ How do i include the js vendor script?

我有一个名为Corners.js的 js 供应商脚本,位于 /vendor/assets/javascripts/ 如何包含 js 供应商脚本?

回答by Radim

Just include

只需包括

//= require Corners.js

in application.js and let the Rails to do the job for you (it automatically includes vendor/assets).

在 application.js 中,让 Rails 为您完成工作(它会自动包含供应商/资产)。

If you are just creating the vendor/assets/javascriptsdirectory, you will need to restart your Rails server.

如果您只是创建vendor/assets/javascripts目录,则需要重新启动 Rails 服务器。