Blocksy theme integration
-
Hello,
I’m writing in regards to this thread from the Blocksy’s support forums.
Because of the way Blocksy implements the dynamic loading of JS files, Simply Static is not aware of the URLs passed to JS via a
wp_localize_script()
call. Also, since the URLs are not automatically discovered by simply static, the underlying JS files are not copied over to the exported archive.Down below I’m trying to outline a way to fix that, in hopes of having a proper integration between Blocksy and Simply Static.
For the whole idea to work we need:
1. A way to parse the HTML body at the end of the
extract_and_replace_urls_in_html()
method. I’ve introduced an action calledss_after_extract_and_replace_urls_in_html
here into which we’ll pass both the$dom
and theUrl_Extractor
objects.
2. Having theUrl_Extractor
object, we need to be able to calladd_to_extracted_urls()
to be able to add arbitrary URLs. So we need to make this method public (now it isprivate
)
3. A way to add more files to the final archive programatically (to add the missing JS files). For that I’ve added an action calledss_after_setup_task
here. At that moment, we will call\Simply_Static\Setup_Task::add_additional_files_to_db('DIR_PATH')
to add more files.All 3 points are implemented in this pull request: https://github.com/patrickposner/simply-static/pull/15
Code that goes into Blocksy for implementing the integration: https://gist.github.com/andreiglingeanu/cba6934ad79fbf6caa36726d2a499ecb
Hope we can get this change in Simply Static (Blocksy will have the integration in the next update which will be out next week at most) so that everyone could have statically exported Blocksy sites!
Thanks for considering this!
- The topic ‘Blocksy theme integration’ is closed to new replies.