The main focus of Loki Theme is to remove legacy JavaScript and replace it with better solutions. This works with any Luma-based theme. However, not all JavaScript is replaced yet. Here you will find a way to gradually cross-over.
Because this project is not done yet, some pages (like the checkout with Loki Checkout and CMS pages) are very easy to migrate: You will want a new Loki theme to be applied to those pages. Yet other pages need more work and therefore require a fallback to a regular theme.
To allow for this, you can use the Yireo_ThemeByRoute module. It allows to define a JSON file app/etc/theme-by-route.json
to determine under which routes (aka URLs) which theme should be loaded:
{
"Loki/luma": [
"cms/index/index",
"cms/page/view"
]
}
If you are working with a Luma-based theme, you simply keep it as is. By adding the LokiTheme_LumaComponents
module, JavaScript will be replaced for the theme is configured in the DI XML type for LokiTheme\LumaComponents\Config\ThemeConfig
. However, because the gradual migration, it is best to first create a new child theme of your own theme.
Assume that your own theme is called YireoTraining/default
. First of all, let's create a new theme YireoTraining/loki
that extends from it. Add a registration.php
file and a theme.xml
file. You don't need much more.
Now, let's apply this theme to the relevant pages by adding a file app/etc/theme-by-route.json
:
{
"Loki/luma": [
"cms/index/index",
"checkout"
],
"YireoTraining/loki": [
"cms/index/index",
"checkout"
]
}
What is left is checking which functionality remains. Where things fail, most likely due to missing JavaScript, new JavaScript needs to be added.