From: Adam R. <ad...@ex...> - 2010-01-25 12:55:27
|
Can we standardise on one implementation and version? 2010/1/25 Thomas White <tho...@gm...>: > It seams we are going to use more and more JavaScript libraries and I > would like to propose a way to organise the code that has been used in > many places and is proven as a good practise. > > There are two main challenges: > > 1. Libraries do change and evolve frequently and in general the code > that worked before, with the next version may not work at all. > 2. When a lot of people are contributing to a project, there is a > strong believe that whatever is used in one application (or page) will > be definitely used by many applications (or pages) later and as a > result a lot of library code are places in a generic directory with > the intention to be used later. In our case 'scripts' directory. > > This type of problems are very ofter when jQuery + jQuery plugins (my > favorite JS library) are used. Some of the plugins require jQuery > version 1.3, some other 1.2 and on the top of that every plugin have > its own versions are not necessarily compatible with each other. > > My proposal is: > 1. Keep Javascript libraries in a subdirectory for the application > until other application uses it. This way every application can have > matching versions.Another advantage is - the application is self > contained and by deleting / coping the directory we can easily > inslall/uninslatll an application. I do believe this is in the most > cases the simplest and easiest way. > 2. If we really have to share JavaScript libraries (more then one > application uses it), then the libraries should be located in > directories that have version number of the library is part of the > directory name. > 3. When jQuery plugins (or other small libraries that depend on main > libraries) are used, then the name of the file should contain the > version number. > 4. The minimised version of every JS file will have '.min.js' suffix. > > > In a long run the best solution will be to have a Static Resources > Manger module that receives the name and the version of a file and > returns a relative or an absolute URL. > > I hope this will help. > Thomas > > > > > > ------ > > Thomas White > > Mobile:+44 7711 922 966 > Skype: thomaswhite > gTalk: thomas.0007 > Linked-In:http://www.linkedin.com/in/thomaswhite0007 > facebook: http://www.facebook.com/thomas.0007 > > ------------------------------------------------------------------------------ > Throughout its 18-year history, RSA Conference consistently attracts the > world's best and brightest in the field, creating opportunities for Conference > attendees to learn about information security's most important issues through > interactions with peers, luminaries and emerging and established companies. > http://p.sf.net/sfu/rsaconf-dev2dev > _______________________________________________ > Exist-development mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-development > -- Adam Retter eXist Developer { United Kingdom } ad...@ex... irc://irc.freenode.net/existdb |