diff --git a/package.json b/package.json index d2f8499..8d84062 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vite-plugin-html", - "version": "2.0.0-beta.3", + "version": "2.0.0-beta.4", "description": "A plugin for vite to Minimize index.html and use lodash.template template syntax in index.html", "main": "dist/index.js", "files": [ diff --git a/src/index.ts b/src/index.ts index 6ebee7c..3108e9a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,7 +26,7 @@ export default (opt: VitePluginHtml = {}): Plugin[] => { transformIndexHtml: { enforce: 'pre', transform: async (html) => { - const { options = {} } = opt; + const { options = {}, title } = opt; let compiledHtml = html; try { @@ -34,7 +34,10 @@ export default (opt: VitePluginHtml = {}): Plugin[] => { // Expose options to the viteHtmlPluginOptions object const compiled = template(compiledHtml); compiledHtml = compiled({ - viteHtmlPluginOptions: options, + viteHtmlPluginOptions: { + title, + ...options, + }, }); } catch (error) { console.error('Template compiled fail\n' + error);