Gaia/Shared

From MozillaWiki
< Gaia
Revision as of 21:08, 6 September 2012 by Andrew Sutherland (talk | contribs) (Created page with "== Overview == There is some shared stuff that is accessible to apps if they want it: * [https://github.com/mozilla-b2g/gaia/tree/master/shared shared] ** [https://github.com/m...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

There is some shared stuff that is accessible to apps if they want it:

How Things Work

non-DEBUG

When you build a profile without specifying DEBUG=1, build/webapp-zip.js is run and it recursively scans the directory sub-tree of your webapp, running a regex for files in "shared/" against all "js", "html", "html", and "css" files it finds. It then processes these paths based on the second-level sub-directory of shared as follows:

  • "js": Found files (ex: shared/js/NAME.js) are copied over, and an error is thrown if they do not exist.
  • "locales": shared/locales/NAME.ini and the contents of the shared/locales/NAME/ sub-directory tree are copied over.
  • "style": shared/style/NAME.css and the contents of the shared/style/NAME/ sub-directory tree except for any html files are copied over.

DEBUG

When you build a profile and specify DEBUG=1, b2g-desktop is run with httpd.js and it has special hackjob magic to try and do the right thing when it sees "shared" in the path.

How to Use shared stuff

Just reference it in your files, and the above magic will make the right thing happen. Probably.