javascript - Use wildcard in src attribute of <script> tag? -


ok, stupid question , don't think it's possible but, have markup @ top of .aspx page...

<%--third party libraries, plugins, extensions --%> <script src="libraries/raphael/raphael.js" type="text/javascript"></script> <script src="autocomplete/jquery.autocomplete.js" type="text/javascript"></script>     <script src="libraries/jquery/1.4.2/jquery.js" type="text/javascript"></script> <script src="libraries/jquery/ui/1.8.4/jquery.ui.core.js" type="text/javascript"></script> <script src="libraries/jquery/ui/1.8.4/jquery.ui.widget.js" type="text/javascript"></script> <script src="libraries/jquery/ui/1.8.4/jquery.ui.mouse.js" type="text/javascript"></script> <script src="libraries/jquery/ui/1.8.4/jquery.ui.draggable.js" type="text/javascript"></script> <script src="libraries/jquery/ui/1.8.4/jquery.ui.droppable.js" type="text/javascript"></script>     

wouldn't nice if replace this...

<%--third party libraries, plugins, extensions --%> <script src="libraries/raphael/raphael.js" type="text/javascript"></script> <script src="autocomplete/jquery.autocomplete.js" type="text/javascript"></script>     <script src="libraries/jquery/1.4.2/jquery.js" type="text/javascript"></script> <script src="libraries/jquery/ui/1.8.4/jquery.ui.*.js" type="text/javascript"></script> 

ie use * wildcard.

obviously js throw scripts 1 big script , load don't fancy doing that.

anyone else have technique tidying masses of script refs? or live it?

as far know not possible, because, browser need know files request.

the browser have brute force server requests hoping lucky.

i'd suggest using google's closure compiler merge similar, if not all, javascript files single file. large, cut down on http request.

with profiling find balance between files needed commonly , speed.

update (from comments)

i'm reluctant offer adding new javascript library solve issue of many javascript libraries :) plus seemed more straight forward solution. current use google closure api compress , merge our javascript , css , build time ant. works charm. can done extent direct apache2 virtual host/htaccess (see html5boilerplate.com) examples , limitations


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -