Creating your first blade

This tutorial will guide you through creating a new blade within a bladeset, using the BladeRunner command-line. You can also create blades and bladesets through the BladeRunner Dashboard UI, available at http://localhost:7070.

Once you’ve installed BladeRunner (and if you haven’t, now might be a good time to have a look at the aptly named Installing BladeRunner page) and created a new application, it won’t be long before you’ll want to create your first blade. This page will walk you through everything you need to know about creating a blade inside your new application. We’ll be using a few terms that you may not be completely familiar with, so if you don’t yet know your bladesets from your bundlers, you might also need to refer to the BladeRunner Architecture Overview page from time to time.

Create a new Bladeset for your Blade

Let’s assume that we’ve already got an application called myexample, and its application namespace is example. As yet, the structure doesn’t have any bladesets, and it looks like this:

br gs newblade1 dir

Creating an FX Bladeset

In a command-line window, create a new bladeset for your application, as follows:

bladerunner create-bladeset <app-name> <new-bladeset-name>

For example, to create a bladeset called fx within the existing myexample app, you would enter:

bladerunner create-bladeset myexample fx

BladeRunner will then create the necessary resources and directories, so that the application structure will look something like this; note that the bladeset folder has "-bladeset" appended to the fx name:

br gs newblade2 dir

Bladeset Namespace

The bladeset namespace is <app-namespace>.<bladeset-name>, which for our purposes means that it’s example.fx.

Namespacing is vitally important for BladeRunner, because it allows the resources that are needed for the entire app to be kept distinct from those needed only for particular blades, bladesets and aspects, and for all of them to be assembled correctly by the bundlers at runtime. This ensures that each blade can be developed as an independent module, but still integrated seamlessly with the app when needed.

Bladeset Resources Folder

The resources folder directly under the <bladeset-name> folder contains the HTML, XML and Internationalisation resources that will be shared between the blades in that bladeset. See the overview of blades and bladesets for further information about how resources are inherited.

Create a Ticket Blade inside the FX Bladeset

Having set up a bladeset and its associated resources, we are ready to create a new blade, which we will call ticket. We’re not going to cover creating the contents of the blade itself on this page (the content of a blade is a component, such as a grid, and there are explanations of how to create particular components in the sections dedicated to them), but an FX ticket is fairly typical example of a blade you might want to create. To create a blade, enter the following into your command-line window:

bladerunner create-blade <app-name> <bladeset-name> <new-blade-name>

To continue our example, that would be:

bladerunner create-blade myexample fx ticket

Having done that, the application structure will look something like this, with the new ticket blade being created within the blades folder.

br gs newblade3 dir

Blade Namespace

The blade namespace is <app-namespace>.<bladeset-name>.<blade-name>, and so in this case will be example.fx.ticket. This ensures that resources belonging to this blade will not be used by any other blades, and will over-ride any shared resources when the settings for this blade need to differ from the ones inherited from the app, aspect or bladeset.