Replace Magento Luma's legacy JavaScript stack with lightweight, CSP-friendly JavaScript and Alpine.js components.
composer require loki-theme/magento2-luma-components
bin/magento module:enable LokiTheme_LumaComponentsThis module removes legacy Luma JavaScript (RequireJS, Knockout.js, jQuery, jQuery UI) and replaces it with custom JavaScript where needed. The following variations for this rewrite exist - taking in mind that this module tries to make as little template override as possible:
- No JavaScript, just plain HTML and CSS;
- Simple JavaScript functions;
- Alpine.js components (with or without custom template);
| Component | Replacement |
|---|---|
| Messages | ✅ Vanilla JS |
| Cookie Notice | ✅ Alpine.js |
| Desktop Navigation | ✅ Alpine.js |
| Mobile Navigation | ✅ Alpine.js |
| Customer Top Links | ✅ Alpine.js |
| Mini Cart | ✅ Alpine.js |
| Newsletter Subscribe | ✅ Vanilla JS |
| Add to Cart (PDP) | ✅ Vanilla JS |
| Add to Cart (PLP) | ✅ Vanilla JS |
| Wishlist / Compare | ✅ Vanilla JS |
| Product Tabs | ✅ Alpine.js |
| Currency Switcher | ✅ Alpine.js |
The goal is to replace legacy JavaScript with the smallest possible number of template overrides.