Skip to main content

Plugins

Less than 1 minuteCookbookVuePressPluginVuePress

With the help of Plugin APIopen in new window, VuePress plugin can provide different features for you.

Community Plugin

Community users have created lots of plugins and published them to NPMopen in new window. VuePress team also maintains some official plugins under the @vuepressopen in new window scope. You should check the plugin's own documentation for detailed guide.

In general, you need to include the plugin in the pluginsopen in new window option to use it. For example, use the @vuepress/plugin-google-analyticsopen in new window to integrate Google Analytics:

import { googleAnalyticsPlugin } from "@vuepress/plugin-google-analytics";

export default {
  plugins: [
    googleAnalyticsPlugin({
      id: "G-XXXXXXXXXX",
    }),
  ],
};

Tips

Most plugins can only be used once. If the same plugin is used multiple times, only the last one will take effect.

However, some plugins can be used multiple times (e.g. @vuepress/plugin-containeropen in new window), and you should check the documentation of the plugin itself for detailed guide.

Local Plugin

To use your own plugin but don't want to publish it, you can create a local plugin.

It is recommended to use the Config File directly as a plugin, because almost all the Plugin APIs are availableopen in new window, which would be more convenient in most cases.

But if you have too many things to do in your config file, you can consider extracting them into separate plugins, and use them in your config file:

import myPlugin from "./path/to/my-plugin.js";

export default {
  plugins: [myPlugin()],
};

You can refer to Advanced > Writing a Pluginopen in new window for how to write your own plugin.