Interesting idea, but I'm trying to keep the
<script> tags in the
browser to a minumum. I finished off the code the
way I suggested this
morning and it seems to work well, so I'll probably
just stick with it
that way. This way also allows me to just include
"myfile.js" in my
page and get everything I need.
Jesse
Raymond Irving wrote:
Well how about generating only browser specific
merge
modules?
dynapi.js
merge.ie.js
merge.dom.js
merge.opera.js
merge.ns4.js
in the browser we could then do the following:
<script src=""></script>
<script>
if(dynapi.ua.ie) {
dynapi.setPath('../src/','merge.ie.js');
}else if(dynapi.ua.opera) {
dynapi.setPath('../src/','merge.opera.js');
}else if(dynapi.ua.ns4) {
dynapi.setPath('../src/','merge.ns4.js');
}else if(dynapi.ua.supported) {
dynapi.setPath('../src/','merge.dom.js');
}else{
alert('Browser not supported');
}
</script>
The dynapi.js file would be compressed and stored
as
dynapi.js. The other browser specific (and
non-specific) libraries could then be merged into a
single file. Only two files will be needed
(dynapi.js
and merge.{whatever}.js)
The setPath() function will support a second
argument
called pkgfile (Package file). This will be used to
allow users to load in an alternative package.js
file
--
Raymond Irving
--- Jesse Vitrone <[EMAIL PROTECTED]>
wrote:
---------------------------------
Thanks for the suggestions Kevin and Raymond,
It looks like I can make my xml something like
this:
<input-group>
<input-filename="D:/development/6thgear/dynapi/src/api/mouse_ie.js"compare-value="dynapi.ua.ie"
/>
<input-filename="D:/development/6thgear/dynapi/src/api/mouse_dom.js"/>
</input-group>
and have my code generate the js:
if (dynapi.ua.ie) {
// mouse_ie.js compressed code goes here
}
else {
// mouse_dom.js compressed code goes here
}
I'll take the first of the group, and make the if.
Everything up to the last will be an else if
And the last, makes the else.
All input-files inside an input-group need a
compare-value, except forthe last one.
This looks like it should work. When I hand code
my
compressed file tolook like the above, it works.
It's
more code then would normally beneeded, since both
files are going to get included, but I can't
thinkof
any other way around this problem. Plus, only the
one
needed willhave to get parsed, so it shouldn't be
too
bad.
What do you think? Do you see any problems that I
might run intotrying to do it this way/
Also, since I have to redo the way the xml is
parsed,
I'm going to usethe built in xml parsing that java
has
and lose that dom4j.jardependency. Not as pretty,
but
it gets the job done.
Thanks for the help.
Jesse
Kevin wrote:
Sorry, didn't send to the list!----- Original
Message
----- From: "Kevin" <[EMAIL PROTECTED]>To:
"Jesse Vitrone" <[EMAIL PROTECTED]>Sent:
Tuesday, June 10, 2003 4:22 AMSubject: Re:
[Dynapi-Dev] compressing files
I mean the packages.js file can help with the
dependency logic for your xml config file.Though I
don't know how to get around the (dom/opera/ns4/ie
layer)*(mouse) file split.The other inline
compressor
method would work here - though server load impact
andno cache of the transient stream :( what! I wish
I
could explain better ).As for this method once a
developer has a custom pre-processed and compressed
fileset published on the server there is no need
for
the library. Difficult to choose. ThoughI like one
bundle per (virtual) server with little
load.-Kevin----- Original Message ----- From: Jesse
VitroneTo: KevinCc: Dynapi-DevSent: Sunday, June
08,
2003 7:19 PMSubject: Re: [Dynapi-Dev] compressing
filesKevin, I'm not sure what you mean about
remove
the existing library system from the api. With the
xml
config that I you can customize, you just pick and
choose what JS files you want it to compress
and
merge. So, I have the basic DynAPI ones, plus the
others that I use, plus my own. It lookssomething
like this:<jscompressor> <compressed-file
name="D:/development/6thgear/js/6thgear_compressed.js">
<input-file
name="D:/development/6thgear/dynapi/src/dynapi.js"/>
<input-file
name="D:/development/6thgear/dynapi/src/api/event.js"/>
<input-file
name="D:/development/6thgear/dynapi/src/api/dyndocument.js"/>
<input-file
name="D:/development/6thgear/dynapi/src/api/dynlayer_base.js"/>
<input-file
name="D:/development/6thgear/dynapi/src/api/dynlayer_dom.js"/>
<input-file
name="D:/development/6thgear/dynapi/src/api/mouse_dom.js"/>
<input-file
name="D:/development/6thgear/dynapi/src/api/ext/dynlayer.inline.js"/>
<input-file
name="D:/development/6thgear/js/6thgear.js"/>
<input-file
name="D:/development/6thgear/js/gearWindow.js"/>
<input-file
name="D:/development/6thgear/js/templates.js"/>
</compressed-file> <compressed-file
name="D:/development/6thgear/js/6thgear_edit_compressed.js">
<input-file
name="D:/development/6thgear/dynapi/src/api/ext/dragevent.js"/>
<input-file
name="D:/development/6thgear/js/6thgear_edit.js"/>
<input-file
name="D:/development/6thgear/js/gearWindow_edit.js"/>
<input-file
name="D:/development/6thgear/js/templates_edit.js"/>