Integrating Sverminal into an existing Svelte project is pretty straightforward...
Install the latest npm package of Sverminal.
npm install sverminal
After installation, import the Sverminal component into your Svelte project...
import { Sverminal } from 'sverminal';
Create a command handling function to manage commands entered in Sverminal...
async function processor(command: string): Promise<void> {
// Your command processing logic here
}
Add the Sverminal component to your app...
<Sverminal {processor}/>
Finally, to correctly render the tailwind styles used by the Sverminal component, you must add the install location to your Tailwind configuration like below...
export default {
content: [
'./src/**/*.{html,js,svelte,ts}',
'./node_modules/sverminal/**/*.{html,svelte,js,ts}'
],
}
After integrating Sverminal into your app, explore the Documentation to discover all the powerful features it offers, including writing to the terminal, requesting user input, autocomplete, and much more.