TIP 187: Flattening the JavaScript Library


The source code for every JavaScript Action that you have used throughout your site is stored in an external JavaScript library called CSScriptLib.js, and GoLive automatically creates the file when you use an Action or a rollover in a Web page. This library file, placed into a folder called GeneratedItems at the top level of your Site, includes all the necessary JavaScript for the Actions for the entire site to function properly (Figure 187).

Figure 187. The CSScriptLib.js file can drastically reduce the download time of the overall site.


Other Web-authoring applications store the JavaScript code in each page, which is repetitive, unnecessary, and can cause your source code to become really bloated. Using an external JavaScript library means that the code for Actions or rollovers used on multiple pages does not have to be reloaded with each and every page that utilizes the Action. Instead, the library loads the code once, the browser caches it, and you get faster-loading pages. Not only that, but GoLive manages all URLs in the JavaScript library, so you can move pages around or even rename them, and all the referenced URLs are updated as necessary by GoLive.

Previous versions of GoLive included the JavaScript code for every installed Action, not just the Actions used. This meant you had to flatten the library for maximum efficiency every time you uploaded the site. GoLive CS2 keeps the JavaScript library lean and mean and only uses the code necessary for the Actions you've used on pages in the site.

If you delete any actions from pages in the site, though, the CSScriptLib.js does need to be flattened. By default, GoLive handles the flattening process automatically when the file is uploaded. You can also flatten it manually if you want to see what the file size will be. Choose Site > Flatten JavaScript Library or use the contextual menu to access the Flatten JavaScript Library command.

Action! Action! Read All About It!

To learn more about some impressive third-party Actions (and extensions, too), see Chapter 13. To see how GoLive's handling of JavaScript Actions stacks up against the competition, download the excellent GoLive JavaScript Actions white paper: http://www.adobe.com/products/golive/pdfs/gl_whtpr_js.pdf.


Trivia

The filename CSScriptLib.js has absolutely nothing to do with CSS. The CS stands for CyberStudio, which was the original name of the application before Adobe acquired it from the company named GoLive Systems.




    Adobe GoLive CS2 Tips and Tricks The 250 Best
    Adobe GoLive CS2 Tips and Tricks The 250 Best
    ISBN: B008CMGJS0
    EAN: N/A
    Year: 2005
    Pages: 301

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net