Apply a Plugin
What is a Plugin?
A Plugin is an extension for Stacks, it allows you to add new capabilities to the Template. You can do that by including source code, importing libraries, and executing complex commands and operations.
Prerequisites
Now, follow the steps below:
Step 1. Check available Plugins
Run the command below:
stk-legacy list plugin
Step 2. Apply the Plugin
Choose the Plugins you want to use, and inside your project directory, run the command below:
stk-legacy apply plugin <STACK-NAME/PLUGIN-NAME>
- If you apply a Plugin that is in the Stack that you have already created using the stk-legacy create app command, it is not necessary to put the Stack name in the command. If it is a Plugin from another Stack, you need to follow the pattern of the example above:
<STACK-NAME/PLUGIN-NAME>
.
Autocomplete is available if you are using bash or zsh.
It is possible to apply a Plugin to a project created without StackSpot. STK CLI informs you when the project is not from StackSpot and asks for your authorization to apply the Plugin.
Step 3. Confirm if the Plugin was applied
Go to your project folder, and run the command:
tree -a
Apply Plugin to your existing project
Context
It is possible to use a Plugin in a project that was not created using a Stack from StackSpot. These projects are called legacy projects.
To apply a StackSpot Plugin to one of your existing projects, follow the steps below:
Prerequisites
You must import a Stack that has at least an available Plugin.
Step 1. Apply the Plugin to the project
Run the command below:
stk-legacy apply plugin <STACK-NAME/PLUGIN-NAME>
Step 2. Confirm usage
STK CLI reports cases where the project was not created using StackSpot. Then it asks for your approval to apply the Plugin:
~stk-legacy apply plugin <stack>/<plugin>
? The current folder doesn't seem to be the root of the Stack Spot project. Do you still want to proceed applying the plugin? (Y/n)
Step 3. Insert inputs
When confirming the Plugin usage, STK CLI asks for specific Plugin inputs before applying it to the project. So, create the stk.yaml
file in your project folder.
Next steps
You can also use Stackfiles to create your project. For more details on how to use a Stackfile, see the Use a Stackfile tutorial.
Was this page helpful?