How to include a vendor multi-module JS library in Rails?

Hello everyone,

I am trying to include a JS library (GeoExt) in an existing Rails application. Following the Asset Pipeline guide, I did:

  • Created the folder /vendor/assets/javascripts/GeoExt to where I copied all the JS modules.

  • Created the file /vendor/assets/javascripts/GeoExt/index.js containing the //= require_tree . directive.

  • In the application.js file included the directive //= require GeoExt.

With this setting I am getting a 404 error every time a module from this library is referenced. What am I doing wrong?

Thank you.

I have not done exactly that. Does it work if you put GeoExt
immediately under assets so /vendor/assets/GeoExt?

Colin

You probably have same problem that I was writing in this post.
https://www.ruby-forum.com/topic/5503104

Javascript library is trying to load modules in runtime. Your chance is
to place javascript files directly to the place (url) where they are
required. Look at the url in error and put javascript files there.

by
TheR

Hi Colin,

No, moving the library a folder up doesn’t not change the outcome.

Thank you,

Luís

Hi Damjan,

These URLs are point to /datasets/mass_import, a path that does not exist in this project:

http://localhost:3000/datasets/mass_import/GeoExt/data/reader/Wmc.js?_dc=1409661484402

If you are correct, then I a do not have much of an idea where to include the library.

Thank you,

Luís