Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vitepress-plugin-search

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vitepress-plugin-search

Provide local search to your documentation site.

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.7K
increased by116.29%
Maintainers
1
Weekly downloads
 
Created
Source

💡 WIP: First working version, no configuration provided!

Provide local search to your documentation site using lunr.
It works for standard vitepress docs using the doc folder.

Getting Started

Basic Steps to make it work!

Installing

npm i vitepress-plugin-search -D

Setup

  • Since we are using the same slot as the default algolia search let's create an alias so our component is used instead
//docs/vite.config.js
import { defineConfig } from "vite";

export default defineConfig({
  resolve: {
    alias: {
      "./components/AlgoliaSearchBox.vue":
        "vitepress-plugin-search/src/Search.vue",
    },
  },
});
  • Add an algolia entry just to pass the v-if in the slots
//.vitepress/config.js
    themeConfig: {
        ...
        algolia: {},
        ...
    }
  • Add lunr_index.js to .gitignore

  • Add scripts to build the index

"prebuild": "npm run index",
"index": "node ./node_modules/vitepress-plugin-search/src/index.js"
  • Build twice before running dev.

  • Build twice on CI/CD

💡 alternatively you can create an script like

"build": "npm run index && vitepress build docs && npm run index && vitepress build docs",

FAQs

Package last updated on 19 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc