• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

BuildTools-About Bundle Format

Page history last edited by Charles Jolley 15 years, 3 months ago

Outline

 

  • What is a bundle?
    • When you build a SproutCore project, the output files are placed in a directory with a special structure called a "bundle".  A bundle contains javascript and any assets needed by that javascript to function properly including stylesheets, images, and so on.  
    • An "application bundle" is a bundle that also contains an index.html file, which you can load directly from your web browser.  
    • All of the urls in an index.html, javascript and other assets are automatically generated so that you can simply drop the bundle into a directory on your deployment server and everything will work.
  • Bundle dependencies
    • In addition to defining resources in a single bundle, you can also setup multiple bundles so that they are dependent on one another.
    • For example, whenever you write a SproutCore application, you are building an application bundle that is dependent on the "sproutcore" bundle.
    • When one bundle is dependent on another bundle, this information is used to automatically generate links to the dependent bundles whenever you build your application bundle.  
    • To deploy a bundle with dependencies, you will need to deploy all of its dependent bundles as well.  This is easy to do because of the sc-build --required option which will automatically build a target and all of its dependencies for you so you can just copy the entire output to your server.
  • Bundle Structure
    • At the root level of all bundles are directories for different languages.  Each language is represented by a two->four letter country/language code such as "en" or "en-US", etc.  
    • Within each language directory, you will see a directory that may look like a long series of hexadecimal number.  This is a "build number".  It is automatically generated by the build system for you based on the contents of your project.  It changes automatically whenever you change your project contents to ensure that caches out on the internet will always load your latest content.  If you don't like this build number, you can always specify the build number you want to use yourself in your Buildfile or on the command line.
    • Within each build directory you will find the assets themselves.  SproutCore places a copy of every assets into each language so that you can easily strip languages without having to worry about asset dependencies.  
    • In addition to static assets that have simply been copied, you will usually see the following files:
      • javascript.js - this contains the combined and minified JavaScript for your bundle
      • javascript-packed.js - this contains the JavaScript for your bundle AND the JavaScript for every other bundle this bundle depends upon.  This is used for optimization.
      • stylesheet.js - the combined and minified CSS styles for your bundle
      • stylesheet-packed.js - the styles for this bundle AND every other bundle this bundle depends upon.
      • index.html - only present in application bundles, this is the actual page that you load in the web browser to display your app.
    • In addition to the above, the build system also generates index.html files that live directly within each language directory and one that lives directly within the root of your bundle.  This allows you to visit URLs in your browser such as /myapp or /myapp/fr and something will load instead of having to visit /mapp/fr/1a3e93afec93c38dae3854

 

Comments (1)

Eric Kidd said

at 9:38 am on Mar 3, 2010

> In addition to the above, the build system also generates index.html files that live directly within each language directory and one that lives directly within the root of your bundle

This does not actually appear to be the case.

You don't have permission to comment on this page.