From 770e55959bb1632ea5e08ae379df980a909abd6f Mon Sep 17 00:00:00 2001 From: biodiscus Date: Sat, 9 Dec 2023 15:30:35 +0100 Subject: [PATCH] test: refactor the test case hook-beforeEmit-rtlcss --- .../hook-beforeEmit-rtlcss/webpack.config.js | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/test/cases/hook-beforeEmit-rtlcss/webpack.config.js b/test/cases/hook-beforeEmit-rtlcss/webpack.config.js index 8451d6da..2c57683a 100644 --- a/test/cases/hook-beforeEmit-rtlcss/webpack.config.js +++ b/test/cases/hook-beforeEmit-rtlcss/webpack.config.js @@ -41,6 +41,8 @@ module.exports = { // explain the structure of the `entry` object //console.dir({ hook: 'beforeEmit', entry }, { depth: 5 }); + let linkTags = ''; + entry.assets.forEach((asset) => { const { type, assetFile, inline } = asset; @@ -53,26 +55,25 @@ module.exports = { if (!inline) { // add new CSS file into compilation compilation.assets[rtlAssetFile] = new RawSource(rtlResult); - - // find inject pos: after the last tag - // TODO: implement your logic to find an inject pos - let pos = content.lastIndexOf(' -1) { - let injectPos = content.indexOf('>', pos); - // inject the style tag with rtl CSS into HTML - if (injectPos > -1) { - injectPos++; - content = - content.slice(0, injectPos) + - `` + - content.slice(injectPos); - } - } + linkTags += ``; } else { // TODO: if CSS asset is inlined inject the