OxygenFramework/Oxygen.jl

Build Static HTML

Closed this issue · 4 comments

If I have a bunch of Julia files that generate HTML strings and are served properly via Oxygen.jl serve() in the browser, how can I build these as static HTML files? For example, I have these files in my src/routes folder and I want to build them and then host them via GitHub pages as .html files

Hi @Dale-Black,

Sorry about the slow turn around, you should be able to host those static files by doing something like the following:

using Oxygen

# Step 1: build the static files
build_html_files()

# Step 2: mount all files inside the "src/routes" folder under the "/static" path
staticfiles("src/routes", "static")

# Step 3: start the web server
serve()

I guess the part I am confused about is the actual build_html_files() portion. Does Oxygen.jl provide this out of the box? If not, how could I go about something like that?

Hi @Dale-Black,

Could you tell me more about your workflow? Based on your initial comment, If you have a bunch of files that generate html strings, just save them to a directory and mount the directory like in my previous example.

Oxygen doesn't include any helper functions to physically generate or save html at the moment. Granted, I do have some changes in the works to support templating. But if you want to physically generate HTML from code I'd recommend Hyperscript.jl or Cobweb.jl to do so.

Hi @Dale-Black ,

Seeing that you were able to create your own package to handle this feature I'm going to close this for now.