Unverified Commit 030b8eab authored by zapashcanon's avatar zapashcanon
Browse files

change structure

parent f0032648
(executable
(name server)
(modules assets server pages template)
(modules content server template)
(libraries dream omd))
(rule
......@@ -10,19 +10,10 @@
(run dream_eml %{deps} --workspace %{workspace_root})))
(rule
(target assets.ml)
(target content.ml)
(deps
(source_tree assets))
(source_tree content))
(action
(with-stdout-to
%{null}
(run ocaml-crunch -m plain assets -o %{target}))))
(rule
(target pages.ml)
(deps
(source_tree pages))
(action
(with-stdout-to
%{null}
(run ocaml-crunch -m plain pages -o %{target}))))
(run ocaml-crunch -m plain content -o %{target}))))
......@@ -2,12 +2,12 @@ let render ~lang ~title ~content =
Template.render_unsafe ~lang ~title ~content:(Dream.html_escape content)
let asset_loader _root path _request =
match Assets.read path with
match Content.read ("assets/" ^ path) with
| None -> Dream.empty `Not_Found
| Some asset -> Dream.respond asset
let page path =
match Pages.read (path ^ ".md") with
match Content.read (path ^ ".md") with
| None -> None
| Some page -> Some (Omd.of_string page |> Omd.to_html)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment