Pergunta

I'm using audiojs in a meteor app and am unsure where to put it in directory. Should this go in public? In lib? If I put it in public and then try to do something like the following, I get errors that audiojs isn't defined. If I try to include the script tag (further down), nothing changes. I didn't expect it to though because I think the audio.min.js file is already being loaded by Meteor.

Rendered:

Template.index.rendered = function() {
    audiojs.events.ready(function() {
        var as = audiojs.createAll();
    }
});

Script Tag:

<script src="/audiojs/audio.min.js"></script>
Foi útil?

Solução

You can put the script in the client/ folder, and then remove the script tag. Meteor will automatically send over any javascript files to the client, and by placing it in the client/ directory, it will prevent issues with the server trying to use it. I tested this and it seemed to work. What were you having trouble with?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top