Socket
Socket
Sign inDemoInstall

vite-plugin-html-meta

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vite-plugin-html-meta

Generate meta tags to html files according to configuration


Version published
Weekly downloads
4
decreased by-20%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

vite-plugin-html-meta

Generate meta tags to html files according to configuration

Demo

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { htmlMetaPlugin } from 'vite-plugin-html-meta'

export default defineConfig({
  plugins: [
    vue(),
    htmlMetaPlugin({
      viewport: {
        width: 'device-width',
        height: 'device-height',
        initialScale: 0.4,
      },
      csp: {
        defaultSrc: ['self'],
        connectSrc: ['http://127.0.0.1:9003', 'ws://localhost:5173', 'http://47.116.130.135'],
        scriptSrc: ['self', 'unsafe-inline'],
        imgSrc: ['data:', 'https://*', 'blob:'],
        workerSrc: ['none'],
        reportUri: 'https://www.baidu.com',
      },
      referrer: 'origin',
      description: 'description',
      keywords: ['HTML', 'vite', 'vite-plugin-html-meta'],
      author: 'QingHuan',
    }),
  ],
})

output

<meta name="viewport" content="width=device-width,height=device-height,initial-scale=0.4" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self';connect-src http://127.0.0.1:9003 ws://localhost:5173 http://47.116.130.135;script-src 'self' 'unsafe-inline';img-src data: https://* blob:;worker-src 'none';report-uri https://www.baidu.com;" />
<meta name="referrer" content="origin" />
<meta name="description" content="description" />
<meta name="keywords" content="HTML,vite,vite-plugin-html-meta" />
<meta name="author" content="QingHuan" />

Type Declarations

type Interactive = 'resizes-visual' | 'resizes-content' | 'overlays-content'

export interface Viewport {
  width?: string
  height?: string
  initialScale?: number
  minimumScale?: number
  maximumScale?: number
  userScalable?: 0 | 1 | 'yes' | 'no'
  viewportFit?: 'auto' | 'contain' | 'cover'
  interactiveSidget?: Interactive
  interactiveWidget?: Interactive
}

export interface CSP {
  defaultSrc?: Array<string>
  scriptSrc?: Array<string>
  styleSrc?: Array<string>
  imgSrc?: Array<string>
  mediaSrc?: Array<string>
  fontSrc?: Array<string>
  objectSrc?: Array<string>
  childSrc?: Array<string>
  connectSrc?: Array<string>
  workerSrc?: Array<string>
  manifestSrc?: Array<string>
  baseUri?: Array<string>
  frameAncestors?: Array<string>
  formAction?: Array<string>
  reportUri?: string
}

export type Referrer =
  'no-referrer' |
  'origin' |
  'no-referrer-when-downgrade' |
  'origin-when-cross-origin' |
  'same-origin' |
  'strict-origin' |
  'strict-origin-when-cross-origin' |
  'unsafe-URL'

export interface htmlMetaOptions {
  viewport?: Viewport
  csp?: CSP
  referrer?: Referrer
  description?: string
  keywords?: Array<string>
  author?: string
}

Keywords

FAQs

Last updated on 15 Aug 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc