## BUILD

The build process:

  - Sources are found by globbing for model.xml files.
  - Sources are built with webpack using the model.xml as the entry file.
  - If there is a 'path' property in the model that will be used as the entry point.
  - Otherwise the default entry points are used (scripts/index.js or styles/index.css).
  - Themes must be named 'theme-'.
  - A temporary directory is created to build into.
  - You can set an environment variable of BB_BUILD_DIR and it will be used to build
    into instead of a temporary directory.
  - There can be only 1 entry point and 1 generated file per item (CSS for theme,
    JS for other items)
  - There is a whitelist of files that will be copied into the package. They are:
    - model.xml
    - config.xml
    - icon.png
    - index.html
    - index.hbs
    - options.json
    - .npmrc
    - assets/**
    - templates/**
    - locale/**
    - media/**

Building CSS:

Only themes have a CSS file generated, and all other items (widgets, UI
components, etc) only have javascript generated. Therefore, to use CSS in non-theme
items, the CSS must be imported into the javascript. The CSS will then be loaded
onto the page via javascript.

Any assets referenced by CSS in themes will be automatically copied into the styles/
directory of the built theme, relative to the generated CSS file. All references
to assets suchs as images or fonts in the CSS will be updated to the new location
(relative to the CSS).

Because there is no CSS file generated for widgets & UIs, there cannot be any references
to assets such as images or fonts in the CSS of widgets and UI components.

Therefore, all assets suchs as images & fonts can only exist in themes, not in widgets
or UI components.

## EXAMPLES

Package the current directory:

```bash
  $ bb-package project
```

Package a separate directory and create my-project.zip:

```bash
  $ bb-package project ./statics --output my-project.zip
```

Specify custom paths for pre-built items, and excluded directories:

```bash
  $ bb-package project ./statics --prebuilt target/bower_components,node_modules \
      --exclude='theme/node_modules,collection-excludeme-*'
```

Exclude prebuilt defaults:

```bash
  $ bb-package project ./statics --prebuilt target/bower_components,node_modules \
      --exclude-defaults
```

Use 'dist' as the build directory instead of a temp dir:

```bash
  $ BB_BUILD_DIR=dist bb-package project
```

Don't package README files in packages:

```bash
  $ bb-package project --ignore-files '**/README.md'
```

Disable the default ignored files (eg: allow bower_components):

```bash
  $ bb-package project --disable-default-ignore
```
