Areas - jasperjs/jasper-application GitHub Wiki

Areas are used to split large applications into parts that can be loaded asynchronously at runtime (see Packaging application for more details). During the packaging process all JavaScript code is split into separate JavaScript files (one file per area).

Each area should represent a single feature (functionality) of the application.

To create a new area type:

yo jasper:area <AREANAME>

For instance:

yo jasper:area profiles

A new area will be created in the app folder. In the project tree an area is represented as a folder with the _area.json configuration file. An area can contain different parts of Jasper application: components, decorators, services etc. All components placed in this folder are treated as parts of this area.

Area configuration

The following properties are specified in the _area.json file:

{
  "name": "profiles",
  "dependencies": [ "core" ]
}

name

Type: String

Specifies the area's name. If undefined, the area's name is the same as the parent folder name.

dependencies

Type: String[]

Areas may depend on other areas. This property specifies an array of names of other areas which should be loaded before this area.

For instance, if ServiceA (from AreaA) is a dependency of ServiceB (from AreaB) you need to specify ["AreaA"] as the dependencies in _area.json of AreaB, because Jasper needs to ensure that AreaA (with ServiceA) is already loaded before creating an instance of ServiceB.

Specify an empty array if an area is not dependent on other areas.

scripts

Type: String[]

Default value: []

Specifies an array of additional scripts which must be loaded during area initialization.

bootstrap

Type: Boolean

Default value: false

Specifies whether an area's scripts and template must be placed to bootstrap script (_base.min.js) during packaging process.

Areas in application

TODO

⚠️ **GitHub.com Fallback** ⚠️