Where to begin coding
This page describes the process of creating a Compatibility Module.
If you already feel at home with Hyvä, this page is probably not for you.
But in case you prefer some guidance, here are the steps we tend to follow when creating compatibility modules.
This page assumes you already have the new, empty, compatibility module installed in your development instance, as outlined in Clone the repository.
The process of creating a compatibility module is slightly different every time, depending on the original module. We are trying to provide an overview here for you to adjust as needed.
First, choose a page that includes some functionality offered by the module.
Open the page in a private browser window and switch to a Luma theme reference store view.
Open the same page in your browser for the Hyvä theme store view.
Open the Browser Console in the Hyvä store view and look for any errors (e.g.
require is not defined).
Locate the template containing the feature of that is causing the error in the original module.
Copy the template into the compatibility module to the same location in
Open the copy in the IDE.
This whole process is described in more detail in the "From Luma to Hyvä" section.
Once the template renders without any errors and the feature works, take a moment to clean up the code, and then move on to the next template.
If there are several templates on a page causing errors, copy all of them to the compatibilty module and short-circuit then with an early return so it is possible to get one after the other working.
Remember to try and take one small step after the other, instead of trying to tackle all at once (that is probably good life advice in general).