Forum: Ruby on Rails How to include a vendor multi-module JS library in Rails?

D474540485aca70530a5a7ef778175fd?d=identicon&s=25 Luís de Sousa (lads)
on 2014-08-28 10:04
(Received via mailing list)
Hello everyone,

I am trying to include a JS library (GeoExt
<https://geoext.github.io/geoext2/>) in an existing Rails application.
Following the Asset Pipeline guide
<http://guides.rubyonrails.org/asset_pipeline.html>, 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.
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2014-08-28 10:24
(Received via mailing list)
On 28 August 2014 09:03, Luís de Sousa <luis.a.de.sousa@gmail.com>
wrote:
>
> 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?

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

Colin
Be07c8d0d6867fd9a0d525f7d17600e2?d=identicon&s=25 Damjan Rems (ther)
on 2014-08-28 14:01
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
D474540485aca70530a5a7ef778175fd?d=identicon&s=25 Luís de Sousa (lads)
on 2014-09-02 14:40
(Received via mailing list)
Hi Colin,

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

Thank you,

Luís
D474540485aca70530a5a7ef778175fd?d=identicon&s=25 Luís de Sousa (lads)
on 2014-09-02 14:47
(Received via mailing list)
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/...

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

Thank you,

Luís
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.