I'm trying to setup a boot project, which uses a resource directory holding a subdirectory public. The later should contain for instance all the web related content, the compiled clojurescript etc.
This makes sense for the case you want to hold resources which are not meant to be exposed publicly.
It works perfectly when doing so without the extra public directory. When trying to use the additional subdir, I'm getting errors. Here are the relevant configurations:
In the build.boot:
(set-env! :resource-paths #{"resources"} ...)
...
(deftask dev
[]
(comp
(serve
:handler 'myapp.server/handler
:reload true
:port 3000)
(watch)
(reload)
(cljs-repl)
(cljs)
(target :dir #{"resources/public"})))
From inside the resources directory:
bash-4.3$ tree
└── public
├── index.html
└── js
└── main.cljs.edn
Whereas main.cljs.edn looks like:
{:require [{{name}}.core]
:compiler-options {:asset-path "js/main.out"}}
When invoking boot dev the following occurs: ClojureScript keeps on compiling with errors, until the process is killed manually. It looks like a recursive error related to some relative paths.
Compiling ClojureScript...
• public/js/main.js
Writing target dir(s)...
java.util.concurrent.ExecutionException: java.nio.file.NoSuchFileException: resources/public/public/public/js/main.out/goog/deps.js
whereas the longer it keeps running the public/public/public/.. expands.
Anybody suggestions where this could be fixed?
Update
Here is an updated version of the question:
Consider this structure of a resources folder:
bash-4.3$ tree
└── private_file.txt
└── public
├── index.html
└── js
└── main.cljs.edn
And the following parts from build.boot:
(set-env! :resource-paths #{"resources"} ...)
(deftask dev
[]
(comp
(serve
:handler 'myapp.server/handler
:reload true
:port 3000)
(watch)
(reload)
(cljs-repl)
(cljs)
(target)))
'myapp.server/handler knows to just serve files from resources/public (implemented by wrap-resource or the compojure equivalent resources. The later even defaults to "private".
But the problem occurs even earlier:
when running boot dev the whole resources directory gets reproduced in the target directory, including private_file.txt of course. (is this intended behavior?, I mean the file could be quite big and then it would consume double of the disc space)
At this point I'm not sure how the :asset-path from inside main affects this. In the example here I kept it to "js/main.out", which might be incorrect.