开发者

How can I dynamically load and execute all of the Javascript files in a directory?

I'm making a very simple content-management system in Javascript. It uses plugins which are individual .js files which live in a "modules" folder. Currently I'm loading them with JQ开发者_StackOverflowuery's getScript() function, but I have to manually define the list of available modules.

Is there any way to dynamically load the list of Javascript files so that the user can install additional modules by simply dropping them into the "modules" folder?


No, you will have to use serverside code for that.


If I were you I would combine them server side with a script like minify, and provide a URL which automatically minifies everything in the modules/ directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜