Issues integrating js file into meteor.js

Hey everyone,

Pretty new to development here, even more so to meteor.js.

I’ve found a pretty interesting tutorial on Codrops Zoom Slider | Codrops, i managed to deploy the files in this file structure:

client → js/css/fonts/images and index.html in the root.

I then left the meteor.js file as is (is.client and is.server functions only) and removed the html and doctype tags from the index.html.

meteor at this point seems to run fine, the css loads, the html and its data loads however all the js files seem corrupted, i get the following error messages in chrome console:

“cannot read property ‘querySelectorAll’ of null”
“unexpected token <”

ive honestly googled and tried to get majority of the issues resolved, and there were loads up to this point :expressionless:

Even if you do not want to fully help, a slight push in the right direction and ill take it from there :smile:

any assistance will be greatly appreciated

thanks,

Josef

Did you perhaps copy code from a website and paste it into a WYSIWYG editor? The “unexpected token <” could be from the start of a HTML tag.

hey, thanks for the reply,

I downloaded it straight from the link that i posted, i managed to actually resolve that issue, it was a lingering < (lol)

This seems to be the issue now, but what i dont understand is that outside of meteor it works perfect, only within meteor it breaks down.

edit:
Okay i think the issue is DOCTYPE html (lack of) and the use of querySelectorAll, not too sure how to resolve it, been googling, if you have any ideas id be greatly appreciative.

well, that code is not for meteor or node.js etc, it is standard client only browser js.
So you need to save it into “public” directory in meteor and reference it from index.html header as any other external js frameworks.

I’d throw it in the compatibility folder if all else fails.

http://docs.meteor.com/#/basic/filestructure

Also you will need to either wrap the js that sets up the widget behavior in the templates onRendered() or register a template helper to do it.

Thats fantastic, so i don’t HAVE to use spacebars to integrate external js files don’t have any actual logic behind them, great news for a beginner, thank you for your input !

I will try all the points that were given, awesome guys really do appreciate the assistance, im sure my questions were daft.

edit:

I think learning to search for the right terms are tricky :slight_smile:

Any other newbies out there, here you go link, its a stackoverflow thread that will help.