Closed fredericalpers closed 10 months ago
Hi @fredericalpers, I checked in the code and see that we have 24 working js files, of which:
@dai-eastgate I will come back to you with an answer as soon as possible
@dai-eastgate Please go ahead and implement the suggested solution. If possible please document the performance improvements before and after.
@dai-eastgate Please go ahead and implement the suggested solution. If possible please document the performance improvements before and after.
OK, I got it. Thanks!
@fredericalpers I need 6 days to implement and test because we have changed a lot of files. Thanks
@fredericalpers A. After implementation, I have some changes compared to the original as follows:
In the Frontend: I have refactored these files:
Estate List: There are 4 files that only load when necessary: onoffice-sort-list-selector.js onoffice-custom-select.js onoffice-form-preview.js onoffice-multiselect.js (async)
Detail View and Similar estate: onoffice_defaultview.js slick.js (defer)
Contact form, Interest form, Owner form: There are 4 files that only load when necessary: onoffice-custom-select.js onoffice-multiselect.js (async) onoffice-estatetype.js(async) onoffice-leadform.js
B. I have added asynchronous properties for 3 files: onoffice-estatetype.js, onoffice-multiselect.js and slick.js. Here are evidence videos of 8 files that I have refactored (The features will be the same as the master branch).
C. Here are some documents on the performance improvements before and after refactoring the code
Current state
Currently all JavaScript and CSS files provided by the plugin are always loaded. This worsens the performance of websites. Also it can cause conflicts with Themes, Builders and Plugins used by external customers and their developers/designers. For our projects we use the WordPress Dequeue Function. However this is not always an option for all customers, especially external customers who are working on the website themselves or with other developers/designers.
Investigate
Investigate if and how we can provide and load the Script and CSS files only if necessary.
Desired state
The JavaScript and CSS files should only be loaded when necessary.