Exporting the First File

The empty exporter produces nothing because it has neither blueprints which define what to export nor mapping which defines where to export. So, let's fix that.

Blueprints define the meta-description of code that will be produced when code generation (the exporter) runs. Blueprints can range from the very simple (as in this tutorial) up to highly-complex ones able to adapt to whatever situation or data you throw at them.

If you are interested in more details, read the overview first. Note that this tutorial keeps everything very simple and you can just skip the details for now.

Create the first blueprint by navigating to the blueprints tab and clicking on the + in the left bottom corner, then select the newly-created blueprint from the list.

The goal is to create the index.html file blueprint, so name it accordingly and add a description as well. blueprint.id (in the Blueprint ID field) is initially generated for you, but you can also set something more readable to you instead. You'll use blueprint.id in the following chapters.

Creating first blueprint entry. It is recommended to describe blueprints well.

Now we will define what to generate when the index blueprint is run. Press Open Blueprint Code in Editor and type any raw text you want to write into the index file. Note that {* comment *} is ignored.

The blueprint editor is a very powerful tool that helps you to craft blueprints - like a code IDE with a data sandbox included. You can learn more about how to use the editor here:

As you type, blueprint editor interprets your code and definitions in real-time

By closing the editor, the blueprint is immediately saved. You can run the test export again but as before, you'll see that no file is produced. This is because even though the blueprint is defined, it actually doesn't participate in the export because it is not mapped yet.

It is possible to define blueprints that only serve as helpers, but don't produce files themselves. Such blueprints are extremely useful for larger projects, where actions and code repeat often.

For example, one good use of such a blueprint would be a header definition that is included in every file. By making it a separate blueprint, changing in one place will propagate everywhere.

Exporting the index.html file

Navigate to the Mapping tab and as before, create a new entry by clicking on the + button at the bottom left corner. A map entry is basically a single command to execute an exporter action. The defaults are correct settings in our case because we want to invoke blueprint when the exporter runs, and specifically to use the index blueprint when invoking. You can fill out the remaining information as before.

Keeping the exporter nice and clean comes in handy with dozens of files

The last thing to do is to define where the file should export. A mapping entry is also a blueprint; however instead of content, it defines a path to a specific file. As this file always belongs to the root directory, open the blueprint editor by clicking on edit path blueprint and just put "index.html" as the blueprint content.

When the exporter runs, the file pathroot/index.html is constructed using the blueprint you just created. Content for the file is then taken from the invoked blueprint. It's possible to construct much much sophisticated and dynamic path blueprints for more complex exporters, but this simple hard-coded file name is sufficient for our example here.

Running the exporter for the first time

When editing and building the exporter, you can always click on Test Export and run the exporter with the current configuration immediately. Let's do that - select an empty folder and then navigate to it. If you did everything correctly, you'll see one file produced, index.html.

Congratulations on your first generated "code"! But the output is rather boring. In the next chapter, we will generate something more interesting.