How to include js file in each template


#1

Hi all,

I have alot of js file in folder client/js/… It contain bootstrap.min.js, custom.js, jquery.js, responsive.js. But I can’t include it in main.html with each template.
I try:
Meteor.startup(function(){
$.getScript(‘js/custom.js’);
});

Please help me to check the problem.
Thanks


#2

They are loaded automatically, you don’t need to use getScript.


#3

for example I need use some DOM, hover, anotation… so I must create some js file. So how I can include it into meteor project. It can’t loaded automatically, right


#4

All files under client/ will be included in your build. However, they may not be included in a way which is usable by you.

From what you’ve said it sounds to me as though you are trying to build a Meteor app based on knowledge of other frameworks. That’s almost certainly not going to work out well for you.

Ideally, you should start by doing the tutorials. Then you should read the Meteor Guide and Meteor API docs.

In the meantime, maybe you could share some code and tell us what you’re trying to do. Perhaps we can help you get started.