[dokuwiki] Re: JavaScript include conditionals

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sat, 20 Jan 2007 16:53:26 +0000

Martin Tschofen wrote:
The style.ini file specifies which css files to include:
media.css      = all
rtl.css        = rtl
print.css      = print

Couldn't we do the same for JS?

test.js       = loadOnce
second.js  = loadAlways

LoadOnce would indicate that if a file name test.js was in an already loaded
template or plugin it no longer loads it.

All js files would be loaded into the one js file that DW maintains just
like the css mechanism.

The nice thing about this is that one could nicely maintain multiple js
files. In my situation I'm using some js libraries that I have to maintain
in one big file. Not ideal.
I think that is fine for a template. But a template doesn't know about plugins and plugins don't know about templates. There is a disconnect between a template having a "test.js" and one or more plugin's having a "test.js". Since, strictly neither knows about the others its up to the wiki admin to ensure they don't use plugins which have naming clashes.

For me, using a helper plugin gets around those problems. By definition there is a single helper plugin that the other components are referencing. I don't see any reason why a template can't include helper plugins too - if its needs them. As I mentioned yesterday, the only issue to resolve then is versioning (versioning would also be a problem for js includes as I mentioned yesterday).

I am sure both methods can be made to work and I think Andi has made his choice, so this debate moot. :)

Cheers,

Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: