Rails 5不会在vendor / assets / javascripts目录中加载js文件

时间:2017-07-20 17:23:22

标签: ruby-on-rails ruby ruby-on-rails-5

我向vendor/assets/javascripts/tooltipster.js添加了一些第三方JS库。之后,我添加了application.js

//= require tooltipster

,但是我收到了这个错误:

couldn't find file 'tooltipster' with type 'application/javascript'

检查这些路径:

  /home/masterbyter/Desktop/theaterway/app/assets/config
  /home/masterbyter/Desktop/theaterway/app/assets/images
  /home/masterbyter/Desktop/theaterway/app/assets/javascripts
  /home/masterbyter/Desktop/theaterway/app/assets/stylesheets
  /var/lib/gems/2.3.0/gems/font-awesome-rails-4.7.0.2/app/assets/fonts
  /var/lib/gems/2.3.0/gems/font-awesome-rails-4.7.0.2/app/assets/stylesheets
  /var/lib/gems/2.3.0/gems/coffee-rails-4.2.2/lib/assets/javascripts
  /var/lib/gems/2.3.0/gems/jquery-rails-4.3.1/vendor/assets/javascripts
  /var/lib/gems/2.3.0/gems/actioncable-5.1.2/lib/assets/compiled
  /var/lib/gems/2.3.0/gems/actionview-5.1.2/lib/assets/compiled

如何在Rails 5中添加第三方JS库?

1 个答案:

答案 0 :(得分:9)

请加入

//= require tooltipster.js
<{1>}中的

,您将需要重新启动Rails服务器。