diff --git a/src/apply/presetModeApply.js b/src/apply/presetModeApply.js index 5026b6d..83d9845 100644 --- a/src/apply/presetModeApply.js +++ b/src/apply/presetModeApply.js @@ -15,9 +15,9 @@ function getThemeExtractLinkTag({ publicPath, userOptions }) { tagName: 'link', voidTag: true, attributes: { - href: `/${publicPath || ''}/${ + href: userOptions.customLinkHref(`/${publicPath || ''}/${ userOptions.outputDir || '' - }/${filename}.css`.replace(/\/+(?=\/)/g, ''), + }/${filename}.css`.replace(/\/+(?=\/)/g, '')), rel: 'stylesheet', id: userOptions.themeLinkTagId, }, diff --git a/src/index.js b/src/index.js index b1bc6f2..7f249be 100644 --- a/src/index.js +++ b/src/index.js @@ -43,6 +43,7 @@ class ThemeCssExtractWebpackPlugin { includeStyleWithColors: [], hueDiffControls: { low: 0, high: 0 }, customThemeOutputPath: '', + customLinkHref: (href) => href }, options ); diff --git a/src/plugin-options.json b/src/plugin-options.json index 4dfe062..299e29d 100644 --- a/src/plugin-options.json +++ b/src/plugin-options.json @@ -61,6 +61,10 @@ "customThemeOutputPath": { "description": "(https://github.com/GitOfZGT/theme-css-extract-webpack-plugin#customThemeOutputPath).", "type": "string" + }, + "customLinkHref": { + "description": "(https://github.com/GitOfZGT/theme-css-extract-webpack-plugin#customLinkHref).", + "instanceof": "Function" } } }