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

Re: [ydn-javascript] What build process you guy are using for JS/CSS?

Expand Messages
  • Dav Glass
    Howard -- We use Ant with our Build Tool: http://yuilibrary.com/projects/builder And YUI Compressor: http://developer.yahoo.com/yui/compressor/ Typically in a
    Message 1 of 5 , May 4, 2009
    • 0 Attachment
      Howard --

      We use Ant with our Build Tool:
      http://yuilibrary.com/projects/builder

      And YUI Compressor:
      http://developer.yahoo.com/yui/compressor/

      Typically in a development environment, you run non-minified code so you
      can see it while you work on it. As well as build your tests with YUI
      Test:
      http://developer.yahoo.com/yui/yuitest/

      Then you minify and package the site for production and run your tests
      again to make sure it's all working.

      As for changed files, it's best to version the minified files. Something
      like this:

      /assets/VERSION/foo.css

      or

      /assets/foo-VERSION.css

      Does that help?
      Dav

      On Mon, 04 May 2009, howard chen wrote:

      > Hey,
      >
      > Just want to know how you guy handle JS/CSS minimization / merging at
      > a production site?
      >
      > Do you use script, e.g. php to handle them all? Or manually?
      >
      > How to do make debugging more easy if files are merged and minified?
      >
      > And How about if files are changed.

      --
      Dav Glass
      davglass@...
      blog.davglass.com


      + Windows: n. - The most successful computer virus, ever. +
      + A computer without a Microsoft operating system is like a dog
      without bricks tied to its head +
      + A Microsoft Certified Systems Engineer is to computing what a
      McDonalds Certified Food Specialist is to fine cuisine +
    • howard chen
      Hello, ... Very useful. Thanks.
      Message 2 of 5 , May 4, 2009
      • 0 Attachment
        Hello,

        On Mon, May 4, 2009 at 10:25 PM, Dav Glass <davglass@...> wrote:
        >
        > Typically in a development environment, you run non-minified code so you
        > can see it while you work on it. As well as build your tests with YUI

        Very useful.

        Thanks.
      • Ken Loomis
        ... I m fairly satisfied with my build process at this point. I developed a make file that includes 3 processes: 1st is the YUI compressor to minimize the
        Message 3 of 5 , May 5, 2009
        • 0 Attachment
          howard chen wrote:
          > Hey,
          >
          > Just want to know how you guy handle JS/CSS minimization / merging at
          > a production site?
          >
          > Do you use script, e.g. php to handle them all? Or manually?
          >
          > How to do make debugging more easy if files are merged and minified?
          >
          > And How about if files are changed.
          I'm fairly satisfied with my build process at this point.

          I developed a make file that includes 3 processes: 1st is the YUI
          compressor to minimize the files, 2nd is a Perl script that converts the
          relative paths in the CSS files to absolute paths, and 3rd is a shell
          cat command that bundles the javascript files together and the css files
          together.

          The one thing I am missing in the process is a way to automatically
          change the files names and update the references to them in the HTML
          files so that I can make use of far future expires.

          Best regards,

          Ken
        • gmoothart
          ... I wrote a server-side function to handle this. In my html, I include javascript like this: The ScriptSrc function
          Message 4 of 5 , May 5, 2009
          • 0 Attachment
            --- In ydn-javascript@yahoogroups.com, Ken Loomis <kloomis@...> wrote:
            > The one thing I am missing in the process is a way to automatically
            > change the files names and update the references to them in the HTML
            > files so that I can make use of far future expires.

            I wrote a server-side function to handle this. In my html, I include javascript like this:

            <%= ScriptSrc( "~/assets/script.js" ) %>

            The ScriptSrc function takes care of resolving the relative path, choosing the minified or full script based on the DEBUG setting (or by checking for localhost), and appending a version string. So the final output could look like this:

            <script src="/application/assets/script-min.js?v=12345" />

            You can also use this approach to do things like load a minified combination script in production, but in DEBUG mode load the individual, full files.
          Your message has been successfully submitted and would be delivered to recipients shortly.