Skip to content

rebuilding when output file is missing (but input has not changed) #192

Description

@daslu

In the following session, I am removing the output HTML file, and recalling build! does not regenerate it.
It would be nice to make it rebuild when the file is missing.

(following a Slack conversation:
https://clojurians.slack.com/archives/C02PF73SETZ/p1659910092271159)

Assume we have a file dummy.clj:

(ns dummy)
(rand)

Then, let us render it with Oz, remove the result HTML, and try to render again.

clj -Sdeps '{:deps {metasoarous/oz {:mvn/version "2.0.0-alpha5"}}}'

$ (require '[oz.core :as oz])

$ (oz/build! [{:from "dummy.clj" :to "dummy.html"}] :live? false :lazy? false :view? false :port 1234)

$ (clojure.java.shell/sh "ls" "-l" "dummy.html") ; verify the HTML exists:
{:exit 0, :out "-rw-rw-r-- 1 daslu daslu 3011 Aug  8 01:02 dummy.html\n", :err ""}

$ (clojure.java.shell/sh "rm" "dummy.html") ; remove the HTML:

$ (oz/build! [{:from "dummy.clj" :to "dummy.html"}] :live? false :lazy? false :view? false :port 1234)

$ (clojure.java.shell/sh "ls" "-l" "dummy.html") ; verify the HTML does not exist:
{:exit 2, :out "", :err "ls: cannot access 'dummy.html': No such file or directory\n"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions