Skip to content
On this page

Vite Press Bootstrap

Config x3

js
import { defineConfig } from 'vitepress'
//append to generated:
export default defineConfig({
  // base:"/vite-press-docs/",//gh
  base:"/",//cloudflare
  srcDir: './src',//relative to the package.json vitepress dev <dir>
  lang: 'en-ca',
  //section inside
  themeConfig: {
    //add better search. https://vitepress.dev/reference/default-theme-search#local-search
    search: {
      provider: 'local',
      options: {
        exclude: (path) => path.endsWith('dev.md'),
      }
    },
    socialLinks: [
      { icon: 'github', link: 'https://github.com/codeforwings/vite-press-docs' }
    ],
    editLink: {
      pattern: 'https://github.com/codeforwings/vite-press-docs/edit/main/docs/:path'
    },
    markdown:{
      //https://vitepress.dev/reference/site-config#markdown
      lineNumbers: true,
      space_size: 2,//not sure if this works
    }
  }
})
js
import { fileURLToPath } from 'url';
const vite = {
    define: { 'process.env': {HOME:'c:/Users/Jason'} },
    resolve: {
      alias: {
        // https://vitejs.dev/config/shared-options.html#resolve-alias
        //https://nodejs.dev/en/api/v18/packages/#subpath-imports
        '##': fileURLToPath(new URL('../..', import.meta.url)),//.vitepress
        '#src': fileURLToPath(new URL('./src', import.meta.url)),//vitesrc... not needed?
        '#docs': fileURLToPath(new URL('../', import.meta.url)),
        //'../..' = path.relative('docs/.vitepress',process.cwd());import {relative} from "node:path/posix";
      },
    }
};
js
import { fileURLToPath } from 'url';
const vite = {
    define: { 'process.env': {} },
    resolve: {
      alias: {
        // https://vitejs.dev/config/shared-options.html#resolve-alias
        //https://nodejs.dev/en/api/v18/packages/#subpath-imports
        '##': fileURLToPath(new URL('./.', import.meta.url)),//CWD
        '#src': fileURLToPath(new URL('./src', import.meta.url)),
        '#docs': fileURLToPath(new URL('./docs', import.meta.url)),
      },
    }
};
jsonc
const package = { /* package.json node sub paths */
    "imports": {
    "##/*": {
      "default": "./*"
    },
    "#src/*": {
      "default": "./src/*"
    },
    "#docs/*": {
      "default": "./docs/*"
    }
  }
}

Folder Tree

txt
docs
├── lib
│   └── gh-pages-push
│       └── ghPagesDeploy.mjs
├── src
│   ├── public
│   └── ssh
│      └── index.md
└── .vitepress
    ├── cache
    │   └── deps
    ├── dist
    ├── theme
    │   ├── index.js
    │   └── style.css
    └── config.js
bash
tree docs -a -L 3 --filelimit 8 --dirsfirst

Webstorm / VSCode shorcuts

  • todo
  • nuxt3-win32-posix-path.git

Vue Utils

  • todo
  • img-anchor
Details
vue
<script setup>
</script>
<template>
<span>Hello World</span>
</template>
<style scoped>
</style>
js
import helloWorld from "@/components/hello-world.vue"

Pnpm Install VitePress

bash
pnpm add -D vitepress
pnpm dlx vitepress init
pnpm add vue -D
bash
pnpm update vitepress@latest
txt
/docs/.vitepress/cache/
/docs/.vitepress/dist/

Markdown-it

  • todo

frontmatter

yaml
---
outline: deep
---