Aspects take multiple blades and use them to compose a view. There are lots of reasons you might want to use an aspect. These could include the following:
- Different aspects for defined steps in an application workflow e.g. Login and Main
- Composing aspects out of application blades for different devices such as tablets or mobiles.
- Aspects for different service levels or user permissions, for example aspects containing more blades providing access to more features for premium customers.
- Of course, you may not have any special requirements at this stage. In which case, you don’t need to do anything. Simply use the default aspect provided.
Benefits of Aspects
Using aspects enables the deployment process to specify the particular blades that it wishes to deploy. This creates a bundle which contains only the required views. This means that you can reuse the same blades across multiple aspects.
For example, the below diagram shows three separate aspects: desktop, tablet and device. It also shows the blades for a web page email search. All three aspects use the search blade. However, the desktop and tablet aspects both use the rich email list blade whereas the mobile blade uses the simple email list blade. This provides a more tailored service to mobile devices and their users.
How to Use Aspects
An aspect consists of an entry index.html page and a set of required resources. Each aspect has access to all the resources and blades in its parent application, but it may be set up only to deliver a fraction of that to the end-users.
You can create new aspects via the command line interface by executing the following instruction:
$ ./brjs create-aspect <app-name> <new-aspect-name>
$ ./brjs create-aspect example-app login
Note: This is only done through the command line at the moment. We will be adding this on the the dashboard at a later date. [Details are on GitHUb](https://github.com/BladeRunnerJS/brjs/issues/748)
Your main app folder is considered your 'default' aspect, which is served up under
/ in the browser for example
localhost/example-app. You may choose instead to use a directory name
default-aspect to provide the same functionality instead. This is useful if you have several aspects, each of which can then be kept within it's own directory. To do this simply move
from directly inside your app directory to a directory nameddefault-aspect` within your app.
For further information, see How to Create an Aspect
Once you have created aspects, see this page to start Adding blades to aspects.