Export Frontend as Static JS/CSS

I love using Anvil’s builder to build frontends, I hate writing UI code and the builder just makes it easy. I also love having a fast backend

I’d love if I could export a static HTML/JS/CSS version of my forms without the server code connections so I supplant them as I need, on any platform I want. I have my backend running through CF Workers and if I could have my existing Anvil forms, but with the frontend and backend both served by CF at the edge that would be amazing. I’m sure I could save one of my form’s HTML and painstakingly wade through everything, but I’d love if the DOM layout would be simplified to make it easier to work with

2 Likes

Forms and other visual component definitions are stored in an Anvil-customized, object-oriented format. If you’ve mirrored your App to a Git repository, locally or on GitHub, then you can see these definitions in the form of hierarchical .yaml files. (CSS is stored in a separate folder.)

In theory, each of these high-level object specifications could be translated into nested HTML (+ JS for interaction logic). The logic for doing that is embedded somewhere in Anvil’s browser-side run-time code, so some cooperation from Anvil would likely be required. This would not be useful to me, so I haven’t looked any further than that.