Jonathan Allen Grant
Jonathan Allen Grant

Reputation: 3658

I'm having trouble including AFRAME in the Asset Pipeline of my Rails application

I want to include AFRAME into my Rails application. So I downloaded the minified version of aframe and in my Asset Pipe I wrote \\= require aframe.min.js

When I try to access my AFRAME object, I get an error that is linked to me missing the ThreeJS files associated with A-Frame.

Is there a way to load the A-Frame js file from the cdn's url instead of from my local server?

Upvotes: 3

Views: 165

Answers (1)

Jonathan Allen Grant
Jonathan Allen Grant

Reputation: 3658

I found a work around. Here it is:

var l=d.createElement('script');
l.setAttribute('src', "https://cdnjs.cloudflare.com/ajax/libs/aframe/0.3.2/aframe.min.js");
h.appendChild(l);

And to access AFRAME I call window.AFRAME

Upvotes: 2

Related Questions