4

I add some third-party JS libraries to the vendor/assets/javascripts/tooltipster.js. After that, I add in the application.js:

//= require tooltipster

, but I get this error:

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

Checked in these paths:

  /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

How to add third-party JS libraries in Rails 5 ?

1 Answer 1

9

Just include

//= require tooltipster.js

in application.js and you will need to restart your Rails server.

Sign up to request clarification or add additional context in comments.

2 Comments

No need to restart the server on require any js in application.js
@puneet18 It seems that the asset paths array is populated once when the server starts. If any of the subfolders of /vendor/assets/javascripts did not exist then Rails will not be looking there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.