I have a small Flask app and I want to use some ClojureScript to enhance the user experience on the client-side.
Now I have trouble serving clojurescript via flask, as the paths get mixed up.
Flask asserts that static files like Javascript scripts lie in a directory static
. I have changed my project.clj
so that the compile target is put there:
:output-to "static/plot.js"
:output-dir "static"
Unfortunately, when loading this file, it cannot load the dependent files with goog.require
:
"ClojureScript could not load :main, did you forget to specify :asset-path?"
I believe that what is missing is a leading /static
instead of static
in the paths.
Can I specify a prefix with leiningen cljsbuild or clojurescript for those inlcudes?
You need to specify an
:asset-path
in your compiled options (as the error message suggests). From https://github.com/clojure/clojurescript/wiki/Compiler-Options#asset-path