Customize Bootstrap
Before a Stackpress application starts, it runs a bootstrap process to load the configuration and plugins.
WARNING: This page exists in case you want to customize the bootstrap process, but in most cases you don't need to customize this process.
If you want to customize the bootstrap process, you can do so by creating a bootstrap file and passing it to the command line interface. The following is a template for the default bootstrap process. You can use this as a basis for your own bootstrap process.
❐ Copy
In the default bootstrap logic, the following steps are performed.
- 1. - Set the configuration.
- 2. - Load all the plugins (from package.json).
- 3. - Let the plugins configure themselves.
- 4. - Let the plugins add events.
- 4. - Let the plugins add routes.
Finally you should return the app instance. This is needed by the Stackpress CLI to conduct business.
NOTE: Make sure you the bootstrap function.
To use your custom bootstrap file you can run the following command in the terminal.
❐ Copy
Manual Loading
Autoloading plugins involves setting the in the project package.json file. When is called, the plugins are loaded automatically. This is the default behavior of Stackpress.
You can disable this feature by importing the plugins manually like the following example.
❐ Copy
In the above example, we are importing the and plugins manually. This is useful if you want to load the plugins in a specific order or if you want to load only some of the plugins. The is a bundled set of all the Stackpress plugins. The following example shows how break down these plugins.
❐ Copy
You can also breakdown the Stackpress plugins in the project package.json file like the following example.
❐ Copy