How to remove error message "cannot resolve file" in require statement in assets/javascript/application.js

Hello friends,

The config setting for this is probably staring right at me, but am not able to figure out how to tell Rubymine to look for some javacript files under my vendor directory.

In my application.js I see squiggly underlines for the following:

//= require tinyeditor/tiny.editor
//= require qtip2/jquery.qtip
//= require UItoTop/jquery.ui.totop

The hover message says: "cannout resolve file 'tiny.editor', etc.

Other js files referenced in application.js that live under assets or are gem based are fine.

I tried setting the load path (right click on the directories under and including "vendor" and selecting "Mark Directory As Load Path Root") but no luck.

I tried adding the parent directories to the paths in the require statement with no luck.

I have my vendor directories configured using config.assets.path in my application.rb:

config.assets.paths << Rails.root.join("vendor", "assets", "lib")

Any pointers would be greatly appreciated!


Comment actions Permalink

I think you could try following configuration:

In application.js add line:

//= require vendor
And content vendor/assets/javascripts/vendor.js:

//= require tinyeditor/tiny.editor
//= require qtip2/jquery.qtip
//= require UItoTop/jquery.ui.totop

Comment actions Permalink

Hi Andrey,

That almost worked!  

The libraries are under vendor/assets/lib so I put the vendor.js under vendor/assets and referenced the libraries

//= require lib/tinyeditor/tiny.editor
//= require lib/qtip2/jquery.qtip
//= require lib/UItoTop/jquery.ui.totop

In this case, in application.js the vendor.js has to be fully qualified.

It also seems to work to fully qualify the paths:

//= require ../../../vendor/assets/lib/tinyeditor/tiny.editor
//= require ../../../vendor/assets/lib/bootstrap/bootstrap
//= require ../../../vendor/assets/lib/qtip2/jquery.qtip
//= require ../../../vendor/assets/lib/UItoTop/jquery.ui.totop

So it appears that RubyMine is only aware of /vendor/assets/javascripts.

Thanks very much for your help!



Please sign in to leave a comment.