@d-gs/vite-plugin-inject-html-tag
v0.0.16
Published
...
Downloads
5
Readme
vite-plugin-inject-html-tag
...
Usage
Install
npm i -D @d-gs/vite-plugin-inject-html-tag
or
pnpm add -D @d-gs/vite-plugin-inject-html-tag
vite.config.ts
import { defineConfig } from 'vite'
import { injectHtmlTag, HtmlTag } from '@d-gs/vite-plugin-inject-html-tag'
const htmlTag: HtmlTag = {
head: {
title: 'App Title',
meta: [
{ name: 'description', content: 'Description' },
{ name: 'theme-color', content: '#000000' }
],
link: [
{
attrs: {
rel: 'apple-touch-icon',
sizes: '180x180'
},
href: '/assets/apple-icon.png'
},
{
attrs: {
rel: 'icon',
sizes: '192x192'
},
href: '/assets/icon.png'
}
]
}
}
<head>
<title>App Title</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="/assets/apple-icon.png" rel="apple-touch-icon" sizes="180x180">
<link href="/assets/icon.png" rel="icon" sizes="192x192">
<meta name="description" content="Description">
<meta name="theme-color" content="#000000">
</head>
head.meta.charset
and head.meta.viewport
are output by default.
To override head.meta.charset
and head.meta.viewport
const htmlTag: HtmlTag = {
head: {
charset: 'shift_jis',
viewport: 'width=device-width,initial-scale=1,viewport-fit=cover',
}
}