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.
精彩评论