From 5133e8d6c000789610bbfc82a7c061826b1de54e Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 18 Aug 2024 21:26:45 +0800 Subject: [PATCH] build: avoid rollup output containing redundant modules --- _javascript/categories.js | 6 ++++-- _javascript/commons.js | 4 +++- _javascript/home.js | 7 +++++-- _javascript/misc.js | 6 ++++-- _javascript/modules/layouts.js | 3 --- _javascript/modules/plugins.js | 6 ------ _javascript/page.js | 8 ++++++-- _javascript/post.js | 16 ++++++++-------- 8 files changed, 30 insertions(+), 26 deletions(-) delete mode 100644 _javascript/modules/layouts.js delete mode 100644 _javascript/modules/plugins.js diff --git a/_javascript/categories.js b/_javascript/categories.js index 15d82513178..b2f80e4bb83 100644 --- a/_javascript/categories.js +++ b/_javascript/categories.js @@ -1,5 +1,7 @@ -import { basic, initSidebar, initTopbar } from './modules/layouts'; -import { categoryCollapse } from './modules/plugins'; +import { basic } from './modules/layouts/basic'; +import { initSidebar } from './modules/layouts/sidebar'; +import { initTopbar } from './modules/layouts/topbar'; +import { categoryCollapse } from './modules/components/category-collapse'; basic(); initSidebar(); diff --git a/_javascript/commons.js b/_javascript/commons.js index 6a17fb93a38..3abb581c686 100644 --- a/_javascript/commons.js +++ b/_javascript/commons.js @@ -1,4 +1,6 @@ -import { basic, initSidebar, initTopbar } from './modules/layouts'; +import { basic } from './modules/layouts/basic'; +import { initSidebar } from './modules/layouts/sidebar'; +import { initTopbar } from './modules/layouts/topbar'; initSidebar(); initTopbar(); diff --git a/_javascript/home.js b/_javascript/home.js index ef22cb97c1f..528a896f51b 100644 --- a/_javascript/home.js +++ b/_javascript/home.js @@ -1,5 +1,8 @@ -import { basic, initSidebar, initTopbar } from './modules/layouts'; -import { initLocaleDatetime, loadImg } from './modules/plugins'; +import { basic } from './modules/layouts/basic'; +import { initSidebar } from './modules/layouts/sidebar'; +import { initTopbar } from './modules/layouts/topbar'; +import { loadImg } from './modules/components/img-loading'; +import { initLocaleDatetime } from './modules/components/locale-datetime'; loadImg(); initLocaleDatetime(); diff --git a/_javascript/misc.js b/_javascript/misc.js index 52b40438c89..3a6176a4f54 100644 --- a/_javascript/misc.js +++ b/_javascript/misc.js @@ -1,5 +1,7 @@ -import { basic, initSidebar, initTopbar } from './modules/layouts'; -import { initLocaleDatetime } from './modules/plugins'; +import { basic } from './modules/layouts/basic'; +import { initSidebar } from './modules/layouts/sidebar'; +import { initTopbar } from './modules/layouts/topbar'; +import { initLocaleDatetime } from './modules/components/locale-datetime'; initSidebar(); initTopbar(); diff --git a/_javascript/modules/layouts.js b/_javascript/modules/layouts.js deleted file mode 100644 index 28f7962591b..00000000000 --- a/_javascript/modules/layouts.js +++ /dev/null @@ -1,3 +0,0 @@ -export { basic } from './layouts/basic'; -export { initSidebar } from './layouts/sidebar'; -export { initTopbar } from './layouts/topbar'; diff --git a/_javascript/modules/plugins.js b/_javascript/modules/plugins.js deleted file mode 100644 index fb892e25bf5..00000000000 --- a/_javascript/modules/plugins.js +++ /dev/null @@ -1,6 +0,0 @@ -export { categoryCollapse } from './components/category-collapse'; -export { initClipboard } from './components/clipboard'; -export { loadImg } from './components/img-loading'; -export { imgPopup } from './components/img-popup'; -export { initLocaleDatetime } from './components/locale-datetime'; -export { toc } from './components/toc'; diff --git a/_javascript/page.js b/_javascript/page.js index 76e8ce97c10..f7268abb781 100644 --- a/_javascript/page.js +++ b/_javascript/page.js @@ -1,5 +1,9 @@ -import { basic, initSidebar, initTopbar } from './modules/layouts'; -import { loadImg, imgPopup, initClipboard } from './modules/plugins'; +import { basic } from './modules/layouts/basic'; +import { initSidebar } from './modules/layouts/sidebar'; +import { initTopbar } from './modules/layouts/topbar'; +import { loadImg } from './modules/components/img-loading'; +import { imgPopup } from './modules/components/img-popup'; +import { initClipboard } from './modules/components/clipboard'; loadImg(); imgPopup(); diff --git a/_javascript/post.js b/_javascript/post.js index 9340f05e70d..f37b1109211 100644 --- a/_javascript/post.js +++ b/_javascript/post.js @@ -1,11 +1,11 @@ -import { basic, initSidebar, initTopbar } from './modules/layouts'; -import { - loadImg, - imgPopup, - initLocaleDatetime, - initClipboard, - toc -} from './modules/plugins'; +import { basic } from './modules/layouts/basic'; +import { initSidebar } from './modules/layouts/sidebar'; +import { initTopbar } from './modules/layouts/topbar'; +import { loadImg } from './modules/components/img-loading'; +import { imgPopup } from './modules/components/img-popup'; +import { initLocaleDatetime } from './modules/components/locale-datetime'; +import { initClipboard } from './modules/components/clipboard'; +import { toc } from './modules/components/toc'; loadImg(); toc();