diff --git a/theme/assets/src/front-end/components/dark-mode-switch.js b/plugin/assets/src/front-end/dark-mode-switch.js similarity index 97% rename from theme/assets/src/front-end/components/dark-mode-switch.js rename to plugin/assets/src/front-end/dark-mode-switch.js index 010912902..d134dfd26 100644 --- a/theme/assets/src/front-end/components/dark-mode-switch.js +++ b/plugin/assets/src/front-end/dark-mode-switch.js @@ -23,7 +23,7 @@ import { themeFromSourceColor, applyTheme, } from '@material/material-color-utilities'; -import { applyRgbValue } from '../../helper/apply-rgb-value'; +import { applyRgbValue } from '../../../../theme/assets/src/helper/apply-rgb-value'; const body = document.body; export const ICONS = { diff --git a/plugin/assets/src/front-end/index.js b/plugin/assets/src/front-end/index.js index 7bcd91e19..83979ea50 100644 --- a/plugin/assets/src/front-end/index.js +++ b/plugin/assets/src/front-end/index.js @@ -28,6 +28,7 @@ import { } from '../common/mdc-components-init'; import { initContactForm } from './contact-form'; import { masonryInit } from './masonry'; +import { initDarkModeSwitch } from './dark-mode-switch'; addEventListener( 'DOMContentLoaded', () => { initButtons(); @@ -45,3 +46,5 @@ addEventListener( 'DOMContentLoaded', () => { initTextFields(); } } ); + +initDarkModeSwitch(); diff --git a/theme/assets/src/customizer/customize-preview.js b/theme/assets/src/customizer/customize-preview.js index b14092285..7a2f98be0 100644 --- a/theme/assets/src/customizer/customize-preview.js +++ b/theme/assets/src/customizer/customize-preview.js @@ -33,7 +33,8 @@ import { debounce } from 'lodash'; * Internal dependencies */ import { masonryInit } from '../front-end/components/masonry'; -import { ICONS as SWITCHER_ICONS } from '../front-end/components/dark-mode-switch'; + +import { ICONS as SWITCHER_ICONS } from '../../../../plugin/assets/src/front-end/dark-mode-switch'; export const COLOR_MODES = { default: 'default', diff --git a/theme/assets/src/front-end/index.js b/theme/assets/src/front-end/index.js index b1835b7de..c1d06127f 100644 --- a/theme/assets/src/front-end/index.js +++ b/theme/assets/src/front-end/index.js @@ -25,7 +25,6 @@ import { tabBarInit } from './components/tab-bar'; import { embedsInit } from './components/embeds'; import { widgetsInit } from './components/widgets'; import { masonryInit } from './components/masonry'; -import { initDarkModeSwitch } from './components/dark-mode-switch'; import './components/navigation'; import './components/skip-link-focus-fix'; @@ -46,5 +45,4 @@ document.addEventListener( 'DOMContentLoaded', () => { embedsInit(); widgetsInit(); masonryInit(); - initDarkModeSwitch(); } );