From: Cameron H. <ca...@bi...> - 2000-12-05 10:31:56
|
This is probably a good way of splitting the code into different browser versions. If you put equivant of #IFDEF (or whatever, it's been a long time since I touched C!) in the source Javascript, you could compile browser specific versions from the one source distribution. At least then, all the code is in one place, and browser specific versions are developed together, not seperately. Cameron. > -----Original Message----- > From: dyn...@li... > [mailto:dyn...@li...]On Behalf Of Dan Steinman > Sent: 04 December 2000 03:52 > To: dyn...@li... > Subject: [Dynapi-Dev] DynAPI Makefile/code compression almost complete > > > This weekend I took on the task of creating a "build" system for DynAPI. > > First part involved writing my own JavaScript whitespace/comment > removal script (in Perl). It's pretty much complete and as good > or better than any others I've seen. I'm calling it JSPack and > will release this as a separate program that must be downloaded > in order to "build" the DynAPI. > > It not only compresses JS code, it also packages the files > together. And this will be used to create js packages for the > DynAPI. For example, it will create the files dynapi.api.js, > dynapi.gui.js... which contain all the classes in that > subdirectory. I have to add one more feature to my script that > determines the order that the objects should be added to the > Package. For example, ScrollPane extends off of ViewPort, so in > the dynapi.gui.js file, viewport.js must be added first. > Therefore I plan to add files to the /lib/dynapi/ directories > that state the order of the files. These will be named .jspack > and will be a simple list of the js files in the order they are > to be added to a package. My JSPack program will take care of the rest. > > Right now JSPack does not parse the JavaScript, so it will not go > through each of your lines and fix and incorrect or missing > semicolon. There for it is essential that all files in the > DynAPI have semi's on each line, as well in the following case: > > f = function() { > }; // absolutely needed > > Second part is the Makefile. Up until now we've just been > editing our files in /js/. But now we can use a separate > directory /src/. This is where we edit our files. Our > JavaScripts can contain comments, and do not have to be bunched > up, because the Makefile will use the /src/ directory, compress > all the code, and produce js packages, and jar files, and output > it to /js/. > > So the /js/ directory will then contain a compressed release of our code. > > In order to build the DynAPi you need to be using unix/linux or > have Cygwin installed in Windows, along with Perl and the JDK > (for Jarring the files). You need to place JSPack in your path, > and then type: > > make > > in the /dynapi/ source tree. This runs the commands in the > Makefile which does everything needed to produce the /js/ tree. > > I'm going through all of the existing JS code and putting the > necessary semi colons, and will have everything ready to use in > another day or 2. A first run-through of building the DynAPI > produced a Jar file which 16KB!!!! (yes the entire DynAPI with > the existing widgets can be compressed a lot). > > We can also use GZip to compress the files for use in IE 5, these > will be a bit smaller than the Jar files. I don't believe there > is any compression we can do for IE 4 though (other than > whitespace removal). > > over and out, > Dan > > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev |