mirror of
https://github.com/MichMich/MagicMirror.git
synced 2026-04-23 22:37:01 +00:00
This is an approach for #2909 It adds 2 values to the config: ```js themeDir: "./", themeCustomScripts: [] ``` `themeDir` must be specified relative to the weather dir. Example config: ```js { module: "weather", position: "top_center", config: { weatherProvider: "openmeteo", type: "current", lat: 40.776676, lon: -73.971321, themeDir: "../../../modules/MyWeatherTemplate/", themeCustomScripts: [ "skycons.js", "weathertheme.js" ], } }, ``` The `themeDir` must contain the 4 files - current.njk - forecast.njk - hourly.njk - weather.css You can add more files (if needed) and add them to the `themeCustomScripts` so they are loaded as script. There are 2 methods inserted which are called if defined: - initWeatherTheme: For doing special things when starting the module - updateWeatherTheme: For doing special things before updating the dom I see this as a simple approach for overriding the default njk templates and css. I did already convert my [MMM-WeatherBridge](https://gitlab.com/khassel/MMM-WeatherBridge) into a template.