开发者

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

开发者 https://www.devze.com 2022-12-25 12:51 出处:网络
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开发者_StackOve

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

精彩评论

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