Integrate meteor with html template unify doesn't work


#1

I bought this template https://wrapbootstrap.com/theme/unify-responsive-website-template-WB0412697. After I extract the zip file, I got a folder with the following structure.
|–assets
| |—css
| |—app.css
| |—js
| |—App.js
| |—img
| |—a.png
|—index.html

If I directly open index.html from chrome, it works fine. But when I integrate with a new meteor project, I got the following error ‘Uncaught ReferenceError: App is not defined’

The way I integrate meteor with this html template is

  1. put assets into public folder
  2. put index.html into client folder wrapped by a template

After some investigation, I found the problem is in index.html(taken from original index.html), it has some code like this at the bottom
----------content in bottom of index.html

--------content in app.js

var App = function () {
// We extend jQuery by method hasAttr
$.fn.hasAttr = function(name) {
return this.attr(name) !== undefined;
};

App.init(); this line throws error ‘Uncaught ReferenceError: App is not defined’. I am guessing this part of the code load before loading assets/js/app.js.

Maybe I am doing it wrong, I should put code in a template onrendered function? anyway, I am new to meteor, can someone help me to solve this problem or tell me how to do it properly


#2

You may want to explicitly load the JS files the “Meteor Way” as is laid out for Meteor 1.3 in the Application Structure guide. If you go this route you’ll also have to keep an eye out to use proper export / import methods as that App variable won’t by default find it’s way into the global namespace.


#3

I used that theme before. Your error has nothing to do with meteor.Unify has many scripts attached and not all are necessary. If you can get the user interface working with css,you can backup app.js and delete everything inside app.js.

You may also not include javascript files not immediately necessary for your project.


#4

Hey, @qubitdev, since you already have some experience with it, it would be more helpful if you’d explain what exactly is the problem, right?


#5

Ok. I have edited my answer.


#6

at the end, I just give up, as there are lots of places I need to make the change.