vite-plugin-auto-meta
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

vite-plugin-auto-meta

Automatically generate <meta> or personalized genrate <meta>

This plugin is a Vite Plugin, and you should use in Vite Project. By the way, it support Vue2, Vue3, React... When your project is Vite Project, you can use it to generate <meta> data.

This plugin can automatically generate keywords by descriptions when the keywords attribute is null. But now the feature only support english, i will try it support more languages on next time.

Welcome to contrubute code here.

Usage

Install

I suggest using pnpm to install because it can quickly install npm package and reuse installed package.

pnpm install unplugin-auto-meta

# or 
npm install unplugin-auto-meta

# or
yarn add unplugin-auto-meta

Using

In vite.config.js / vite.config.ts

This is no names, httpEquivs and charset usage, see bellow:

import UnpluginAutoMeta from 'unplugin-auto-meta'

export default defineConfig({
  plugins: [
    vue(),
    UnpluginAutoMeta({
      name: 'vite-vue3',
      description: 'This is an amusing project, show us contents about vue3 and vite.',
      author: 'qinghuan',
    })
  ],
})

This is have names, httpEquivs and charset usage, if you set author(description, keywords) in names that can overflow name, author, description see bellow:

import UnpluginAutoMeta from 'unplugin-auto-meta'

const options = {
  names: [
    { key: 'author', value: 'qinghuan22' },
  ],
  httpEquivs: [
    { key: 'Content-Security-Policy', content: "default-src 'self'; img-src https://*; child-src 'none';" },
  ]
}

export default defineConfig({
  plugins: [
    vue(),
    UnpluginAutoMeta({
      name: 'vite-vue3',
      description: 'This is an amusing project, show us contents about vue3 and vite.',
      author: 'qinghuan',
      ...options
    })
  ],
})

Package Sidebar

Install

npm i vite-plugin-auto-meta

Weekly Downloads

7

Version

0.2.0

License

MIT

Unpacked Size

79.3 kB

Total Files

35

Last publish

Collaborators

  • qinghuanaa