Loading ...
Sorry, an error occurred while loading the content.

3512Re: "Skinning" the YUI

Expand Messages
  • mori57
    Jul 31, 2006
      Still no responses on this issue from any of the developers of the YUI...?

      Well, in the meantime, here's an idea of something I started playing with.

      In the Yahoo.js file, I add:
      /**
      * Stubs to add to YAHOO object to make it easier to maintain the
      * paths to assets used by other modules in the YUI toolkit.
      */
      YAHOO.cfg.PROTOCOL =
      (document.location.protocol=="https:")?"https:":"http:";
      YAHOO.cfg.SERVER = document.location.host;
      YAHOO.cfg.BASEURL= YAHOO.cfg.PROTOCOL + "//" + YAHOO.cfg.SERVER;
      YAHOO.cfg.ASSETS = {};
      // below are user-set properties to point at their own dirs
      YAHOO.cfg.ASSETS["IMG"] = YAHOO.cfg.BASEURL + "/images/yui/";
      YAHOO.cfg.ASSETS["SHIM"] = YAHOO.cfg.ASSETS.IMG + "shim.gif";

      Then, it's simply a matter of changing the other related files to get
      rid of the hardcoded refs, calling instead YAHOO.cfg.ASSETS.IMG, or
      .SHIM when they need to get those resources.

      Any thoughts on whether this would be a sound approach? It means that
      users only have to worry about modifying one file (Yahoo.js), as
      opposed to tracking changes through multiple files and recompiling the
      JS every time a new version comes out.
    • Show all 5 messages in this topic