Repository navigation
v2.1.4 — Phase 9.8: frontend assets + Alpine.js extraction
·
70 commits
to epic/refactor-april
since this release
Phase 9.8 — Frontend Assets + Alpine.js Extraction
Five frontend asset methods leave the god-class for dedicated single-responsibility classes under src/Frontend/Assets/. Each class registers its own WordPress hook via register(); Plugin::registerHooks() wires them.
Added
StylesEnqueuer—wp_enqueue_scripts(frontend stylesheet w/ filemtime cache buster)AlpineJsEnqueuer—wp_footerpriority 5 (conditional Alpine 3 CDN load)PromoCopyScript—wp_footerpriority 20 (copy-to-clipboard inline JS)AlpineDeferAttribute—script_loader_tagfilter (defer attribute)WidgetShortcodeDetector—widget_textfilter (shortcode-in-widget detection)
Removed from god-class
enqueue_frontend_assets(),maybe_enqueue_alpine(),enqueue_promo_copy_script(),add_alpine_defer_attribute(),check_widget_for_shortcode()- Four corresponding
add_action/add_filterregistrations frominit_hooks()
Compatibility
No public contract change. Alpine 3.13.5 still loaded from the same jsDelivr URL, still filterable via dataflair_alpinejs_url. Stylesheet handle and footer-script ordering (priority 5/20) byte-identical.
Stats
- Tests: 18 new tests; full suite 452 tests, 1,062 assertions, all green
- LOC:
dataflair-toplists.php2,347 → 2,165 (-182)