⮌ back | Home

Installing astro-vtbot

astro-vtbot can be installed as a full Astro integration or as a node package. Both ways install the package as a dependency in your project and allow you to import its components and scripts in your own pages. Installing the package as an Astro integration in addition sets up your project with an automatic loading indicator and automatic linter warnings in the browser console. Installing as an integration also gives you access to The Bag’s DevToolbar App!

Contents

Installing as an Astro integration

Installing astro-vtbot as an Astro integration will install the package and in addition it will by default add vtbot’s <LoadingIndicator /> component and <Linter /> component to all pages that use Astro’s <ViewTransitions />. However, there are also options to selectively opt out of either feature, as detailed below.

To install astro-vtbot as an Astro integration, run the astro add command in your project directory …

Terminal window
npx astro add astro-vtbot

… and press the return key twice to answer the questions with “yes”:

Terminal window
astro-vtbot is not an official Astro package. Use at your own risk!
Continue? yes
Resolving with third party packages...
10:26:47
Astro will run the following command:
If you skip this step, you can always run it yourself later
╭─────────────────────────────────╮
npm install astro-vtbot@^1.2.0
╰─────────────────────────────────╯
Continue? yes
Installing dependencies...
10:26:52
success Configuration up-to-date.

As a result astro-vtbot will hook into your astro.config file:

astro.config.mjs
import { defineConfig } from "astro/config";
import vtbot from "astro-vtbot";
// https://astro.build/config
export default defineConfig({
integrations: [vtbot()],
});

When you start Astro in DEV mode, e.g. npm run dev, this will automatically add vtbot’s <Linter /> component to all pages that use Astro’s <ViewTransitions />. This will only happen in DEV mode. When you build for production, the <Linter /> component will not be included.

You can disable automatic linting and the loading-indicator without having to remove the integration by setting the loadingIndicator option and/or the autoLint option of vtbot in your astro.config file to false (the default is true):

astro.config.mjs
import { defineConfig } from "astro/config";
import vtbot from "astro-vtbot";
export default defineConfig({
integrations: [vtbot({
loadingIndicator: false, autoLint: false
})],
});

After disabling the loadingIndicator, as an alternative, you could also add the <ProgressBar /> component to your Layout.astro.

If you have Astro’s DevToolbar enabled, The Bag will show up as a new app there and will give you access to the InspectionChamber on every page without any further modification of your project.

Installing as a node package

To install astro-vtbot as a node package without the integration, run the following command in your project directory:

Terminal window
npm install astro-vtbot