From f6b39bd3b80092cd47ec6b084ec60ecf686b6a44 Mon Sep 17 00:00:00 2001 From: Ourai Lin Date: Fri, 7 Apr 2023 08:46:30 +0800 Subject: [PATCH] fix(hexo): URL of font for stylesheets --- bin/build.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/build.js b/bin/build.js index 65701a8..7950855 100644 --- a/bin/build.js +++ b/bin/build.js @@ -20,13 +20,18 @@ function copyAssets(distRoot, polyfill) { const distStyleDirPath = `${distRoot}/stylesheets/ksio/`; const shareSnsStyleFilePath = `${distStyleDirPath}/vendors/share.scss`; - - saveData(shareSnsStyleFilePath, readData(shareSnsStyleFilePath).replace(new RegExp('fonts/vendors/share', 'g'), 'ksio/vendors/share')); + const shareSnsStyleFileContent = readData(shareSnsStyleFilePath); if (!polyfill) { - return; + return saveData(shareSnsStyleFilePath, shareSnsStyleFileContent.replace(new RegExp('fonts/vendors/share', 'g'), 'ksio/vendors/share')); } + saveData(shareSnsStyleFilePath, shareSnsStyleFileContent.replace(new RegExp('fonts/vendors/share', 'g'), '../../../fonts/ksio/vendors/share').replace(new RegExp('font-url', 'g'), 'url')); + + const faStyleFilePath = `${distStyleDirPath}/polyfills/_font-awesome-sprockets.scss`; + + saveData(faStyleFilePath, readData(faStyleFilePath).replace(' font-path($path)', ' "../fonts/ksio/polyfills/#{$path}"')); + ['_all', '_bootstrap-custom', '_helper', '_painter'].forEach(fileName => { const filePath = `${distStyleDirPath}/${fileName}.scss`; const bsStr = fileName === '_all' ? 'bootstrap-sprockets' : 'bootstrap';