Browse Source

decruft: split FullCalendar to an About-only bundle (−263 KB site-wide)

FullCalendar is only used by the About #calendar but was bundled site-wide.
New webpack entry src/fullcalendar.js → js/v4-fullcalendar.min.js (+ keep
css/v4-fullcalendar.css standalone); removed it from src/main.js and
src/legacy-style.js; dw_scripts enqueues both on is_page('about') only, before
about.js consumes window.FullCalendar. Site-wide v4-script.min.js 503→240 KB,
v4-style.min.css 278→253 KB. About unchanged (loads the split bundle).
windhamdavid 1 week ago
parent
commit
434dc0421b

+ 1 - 1
_claude/notes/dependencies.md

@@ -36,7 +36,7 @@ whole messenger/online-status feature, page-chat + `chat.*`, `terminal.js`, `mod
 |---|---|---|
 | ~~Bootstrap 5 full~~ → **subset** | −49 KB | **✅ DONE 2026-06-21** — only used partials imported (grid/offcanvas/carousel/nav/forms/buttons/tables/list-group/card/pagination/alert + utilities API); dropped modal/dropdown/tooltip/popover/accordion/toasts/etc. Full removal still the end-goal. |
 | ~~animate.css~~ + ~~WOW~~ | ~~93 KB~~ CSS + JS | **✅ DONE 2026-06-21** — both dropped (npm deps removed, bundle imports + the 4 `new WOW().init()` calls gone). v4-style 348→278 KB. The 26 inert `.wow`/`fadeIn*` classes left in markup to re-enable later if wanted. |
-| fullcalendar CSS | 40 KB | About-only → conditional-load, or replace calendar |
+| ~~fullcalendar~~ (CSS + JS) | ~~40 KB CSS~~ + 263 KB JS off site-wide | **✅ DONE 2026-06-21** — split to an About-only bundle: `js/v4-fullcalendar.min.js` + `css/v4-fullcalendar.css`, enqueued in dw_scripts on `is_page(about)` only. Site-wide `v4-script.min.js` 503→240 KB, `v4-style.min.css` 278→253 KB. (v6 upgrade still its own task.) |
 | `style.css` custom | 58 KB | per-page: `.entry-content`/`.posts-front`/`.archive-page`/carousel rules die as each page blockifies |
 | `fonts.css` @font-face | 39 KB | shrinks as icon fonts above are dropped |
 

+ 4 - 0
functions.php

@@ -64,6 +64,10 @@ function dw_scripts() {
 
 	if ( is_page('about') ) {
 		wp_enqueue_script( 'scriptmin', get_template_directory_uri() . '/js/v4-script.min.js', '', '', true );
+		// FullCalendar is About-only — load its bundle + CSS here (before about.js consumes it),
+		// not site-wide.
+		wp_enqueue_style( 'fullcalendar', get_template_directory_uri() . '/css/v4-fullcalendar.css' );
+		wp_enqueue_script( 'fullcalendar', get_template_directory_uri() . '/js/v4-fullcalendar.min.js', '', '', true );
 		wp_enqueue_script( 'init', get_template_directory_uri() . '/js/about.js', '', '', true );
 	}
 

File diff suppressed because it is too large
+ 1 - 0
js/v4-fullcalendar.min.js


+ 20 - 0
js/v4-fullcalendar.min.js.LICENSE.txt

@@ -0,0 +1,20 @@
+/*!
+FullCalendar v5.11.3
+Docs & License: https://fullcalendar.io/
+(c) 2022 Adam Shaw
+*/
+
+/*! *****************************************************************************
+    Copyright (c) Microsoft Corporation.
+
+    Permission to use, copy, modify, and/or distribute this software for any
+    purpose with or without fee is hereby granted.
+
+    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+    PERFORMANCE OF THIS SOFTWARE.
+    ***************************************************************************** */

File diff suppressed because it is too large
+ 0 - 0
js/v4-script.min.js


+ 0 - 21
js/v4-script.min.js.LICENSE.txt

@@ -53,25 +53,4 @@
  * Released under the MIT license
  */
 
-/*!
-FullCalendar v5.11.3
-Docs & License: https://fullcalendar.io/
-(c) 2022 Adam Shaw
-*/
-
-/*! *****************************************************************************
-    Copyright (c) Microsoft Corporation.
-
-    Permission to use, copy, modify, and/or distribute this software for any
-    purpose with or without fee is hereby granted.
-
-    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-    PERFORMANCE OF THIS SOFTWARE.
-    ***************************************************************************** */
-
 /*! js-cookie v3.0.8 | MIT */

+ 12 - 0
src/fullcalendar.js

@@ -0,0 +1,12 @@
+/**
+ * FullCalendar bundle (→ js/v4-fullcalendar.min.js) — split out of the site-wide main
+ * bundle so it's enqueued ONLY on the About page (its sole consumer: about.js does
+ * `new FullCalendar.Calendar(#calendar)`). The CSS stays in css/v4-fullcalendar.css,
+ * also enqueued only on About.
+ *
+ * fullcalendar/main.js is a bare `var FullCalendar = …` global build; exports-loader
+ * (webpack.config.js) captures it. The object carries `__esModule:true` with no
+ * `.default`, so use a namespace import (same trick as the old main.js usage).
+ */
+import * as FullCalendar from 'fullcalendar/main.js';
+window.FullCalendar = FullCalendar;

+ 0 - 1
src/legacy-style.js

@@ -11,6 +11,5 @@
  * e.g. fullcalendar — in Phase 5, not here).
  */
 import '../css/fonts.css';
-import '../css/v4-fullcalendar.css';
 import '../css/styles.scss';
 import '../style.css';

+ 0 - 8
src/main.js

@@ -12,14 +12,6 @@ window.$ = window.jQuery = $;
 import * as bootstrap from 'bootstrap'; // also registers BS5 data-api (offcanvas, etc.)
 window.bootstrap = bootstrap;
 
-// fullcalendar's main.js is a bare `var FullCalendar = …` global build; exports-loader
-// (webpack.config.js) captures that var as module.exports. The object carries an
-// `__esModule:true` flag but no `.default`, so a *default* import would unwrap to
-// undefined — use a namespace import to grab the object itself, then re-expose it
-// on window for about.js (`new FullCalendar.Calendar(...)`).
-import * as FullCalendar from 'fullcalendar/main.js';
-window.FullCalendar = FullCalendar;
-
 import Cookies from 'js-cookie';
 window.Cookies = Cookies;
 

File diff suppressed because it is too large
+ 0 - 0
v4-style.min.css


+ 4 - 1
webpack.config.js

@@ -25,8 +25,10 @@ module.exports = {
     'v4-style': './src/legacy-style.js',
     // Reproduces gulp `jsf` → homepage JS (jquery + svg-morpheus + front-page.js).
     front: './src/front.js',
-    // Reproduces gulp `js` → site-wide JS (jquery/bootstrap/fullcalendar/plugins).
+    // Reproduces gulp `js` → site-wide JS (jquery/bootstrap/plugins).
     main: './src/main.js',
+    // FullCalendar — split out of the site-wide bundle; enqueued only on the About page.
+    'v4-fullcalendar': './src/fullcalendar.js',
   },
   output: {
     path: path.resolve(__dirname), // theme root
@@ -37,6 +39,7 @@ module.exports = {
       const n = pathData.chunk.name;
       if (n === 'front') return 'js/v4-front.min.js';
       if (n === 'main') return 'js/v4-script.min.js';
+      if (n === 'v4-fullcalendar') return 'js/v4-fullcalendar.min.js';
       return 'build/[name].js';
     },
     clean: false, // NEVER clean — output.path is the theme root

Some files were not shown because too many files changed in this diff