As you learned, each exporter package contains all the blueprints it needs to run. However, on its own, blueprints don't run, they are just definitions that can be executed. In order for a blueprint to run, you need to "map" them, meaning you have to specify what blueprints go into what destination when exported.
For example, to export Readme.md
file into a root directory of the export, following needs to happen:
A blueprint is created that contains content of the Readme.md
file
Mapping is created that selects the blueprint (1) and invokes it on export
The mapping file path is constructed, which tells blueprint where to write on export
Mapping can be accessed through Exporter Editor by selecting the mapping
tab
All mapping commands are listed in the left section of the mapping tab. You can add new mapping entry by clicking on +
button and remove it either by right-clicking or selecting the mapping and clicking on -
button at the bottom of the list.
Grouping
Each mapping entry is part of the group. If no group is provided, Main
group is used, otherwise the group you created is used instead. Use groups to logically separate mapping by their functionality or purpose, such as "Root Files", "Support Files", "Assets File", and any other you deem useful.
Following properties are available:
Mapping Name
- The name of the mapping entry, shown everywhere inside Supernova
Group
- The specific group that mapping belongs to. Mappings with the same name are sorted under the same category in the left panel
Description
- Description of the mapping for your reference
Action Type
- Action that should be executed when mapping is invoked. Currently, only action available is to Invoke Blueprint
, but more will be available down the road
Invoked Blueprint
- When Action Type
is Invoke Blueprint
, this field selects blueprint to execute
The most important thing to know about the mapping that it also has a blueprint attached to it. But this blueprint doesn't participate in content generation. Instead, it tells the exporter how to construct the file path for this specific file. You can access the blueprint by clicking on Edit Path Blueprint
.
You can see the file path defined in the blueprint above. This mapping will take Main.dart
blueprint (you defined that by setting Invoked Blueprint
to a specific value) and then write the result to [export directory] / lib / main.dart
.
The true power of mapping blueprint comes from the ability to create dynamic paths. For example, if you want to export screens, you want every screen file to have a different name. You can do that through a dynamic blueprint that takes its name, and then uses it in the output.
Note that mapping blueprint takes invocation
settings (export once, export once per screen, and so on) from the blueprint that it invokes, and doesn't have invocation settings on its own.