Static file support

This commit is contained in:
Aleks Rūtiņš 2024-09-09 06:43:14 -04:00
parent 46b5593cb3
commit a284657783
3 changed files with 8 additions and 0 deletions

View file

@ -6,6 +6,7 @@ target :lib do
check "lib" # Directory name
# ignore "lib/templates/*.rb"
library "fileutils"
# library "pathname" # Standard libraries
# library "strong_json" # Gems
# library "phlex"

View file

@ -17,6 +17,12 @@ class Phlexite::Router
File::write(out, component.call)
end
def mount(local_directory, on:)
out = full_out_path(on)
FileUtils::mkdir_p out
FileUtils::cp_r File::join(local_directory, "."), out
end
private
def full_out_path(out_path)

View file

@ -8,6 +8,7 @@ module Phlexite
def initialize: (String, Site) -> void
def page: (String, untyped) -> void
def group: (String) { (Router) -> void } -> void
def mount: (String, on: String) -> void
private
def full_out_path: (String) -> String