How do I include plugins in HTML5 Boilerplate (plu

2019-09-08 15:40发布

I'm testing out HTML5 Boilerplate, but I don't quite get how to setup the plugins.js-file.

I've tried to copy the contents of plugins in manually, like this:

(function($){
   //minimized source of plugin #1
})(this.jQuery);

(function($){
   //minimized source of plugin #2
})(this.jQuery);

//and so on...

But it got quite time consuming and hard to maintain.

I then tried to use the "vender"-folder and include from there:

$.getScript("vendor/waypoints.min.js", function(){
   alert("Success");
});

But then I get the following errors (Chrome console) when testing locally:

OPTIONS file:///Users/myusername/Sites/H5BPtest/js/vendor/waypoints.min.js?_=1371722230114 Origin null is not allowed by Access-Control-Allow-Origin.

XMLHttpRequest cannot load file:///Users/myusername/Sites/H5BPtest/js/vendor/waypoints.min.js?_=1371722230114. Origin null is not allowed by Access-Control-Allow-Origin. 

What to do? I would prefer to have all plugins in a folder (e.g. "vendor"), and then load them somehow.

Also an automated solution that takes alle the .js-plugin-files and combines them to one, would be cool. But I haven't seen any easy to use solutions on that (I'm not that technical)...

I need to test locally, because I'm using some design tools, that doesn't work via a server. I'm on OSX, if it makes any difference.

Any help would be very, very appreciated!

0条回答
登录 后发表回答