1
0
mirror of https://gitee.com/vant-contrib/vant.git synced 2025-04-27 20:06:36 +08:00

feat(cli): add site.headHtml option

This commit is contained in:
chenjiahan 2022-07-17 15:53:43 +08:00
parent 27c3cbcf89
commit d4ab4214ef
3 changed files with 9 additions and 0 deletions
packages/vant-cli
site
src/config

@ -19,6 +19,9 @@
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<% if (headHtml) { %>
<%- headHtml %>
<% } %>
<% if (htmlWebpackPlugin.options.usingSearch) { %>
<link
href="https://fastly.jsdelivr.net/docsearch.js/2/docsearch.min.css"

@ -19,6 +19,9 @@
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<% if (headHtml) { %>
<%- headHtml %>
<% } %>
<% if (htmlWebpackPlugin.options.baiduAnalytics) { %>
<script>
// avoid to load analytics in iframe

@ -15,6 +15,7 @@ import {
export function getSiteDevBaseConfig(): WebpackConfig {
const vantConfig = getVantConfig();
const headHtml = get(vantConfig, 'site.headHtml');
const baiduAnalytics = get(vantConfig, 'site.baiduAnalytics');
function getSiteConfig() {
@ -89,6 +90,7 @@ export function getSiteDevBaseConfig(): WebpackConfig {
chunks: ['chunks', 'site-desktop'],
template: join(__dirname, '../../site/desktop/index.html'),
filename: 'index.html',
headHtml,
baiduAnalytics,
...htmlPluginOptions,
}),
@ -99,6 +101,7 @@ export function getSiteDevBaseConfig(): WebpackConfig {
chunks: ['chunks', 'site-mobile'],
template: join(__dirname, '../../site/mobile/index.html'),
filename: 'mobile.html',
headHtml,
baiduAnalytics,
...htmlPluginOptions,
}),