Enonic version: 6.13.1
I’m trying to create an admin tool that exposes HTML-files created by a static site generator called PatternLab (it’s a design system framework). Due to the fact that it relies on iframes it creates some challenges for me, wrt referring to resources.
I was wondering if there are any best practices on how to do this, or if there are examples of someone handling this already? What I’m trying to do now is to output all the HTML-files created by PL into the assets-folder, and with a little bit string-replace “fixing” all of the paths to resources. It also forces me to monkey-patch some of the resources handled by PL. Understandably I’m hesitant on continuing down this rabbit hole, so all suggestions are appreciated
So. You have a generated html-site with flat files, and want to display these inside an admin tool?
A bit unclear what your problem is, is it the links that are not relative?
How are you currently bootstrapping the files from the tool? Are you setting up an iframe, or this done by the generator?
The problem was that Pattern Lab (PL) had some underlying assumptions on how files were referenced:
- Referenced files should belong to same path as the file which referenced them
- URLs should be available on build-time
- The generated index file is the outermost file (i.e. no other file can reference that index-file through an iframe)
I managed to circumvent these limitations by monkey-patching PL. I’ve also documented this, so hopefully it won’t be to painful when we need to upgrade PL…
The intent with my original question was to find any project that might be similar, so that I might learn from their solutions. But the monkey-patching is working fine. (Although I don’t like monkey-patching.)