ibdknox/cljs-watch — Issue #12: auto-create resources/public/cljs
Author: claj
Created: 2012-01-01 17:07:19+00:00
State: open

After installing the cljs-watch I ran it in my webnoirbased project. I did at first however get the following error message:

$cljs-watch
17:59:50 :: watcher :: Building ClojureScript files in :: src/java.io.FileNotFoundException: resources/public/cljs/bootstrap.js (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:194)
at clojure.java.io$fn__7884.invoke(io.clj:224)
at clojure.java.io$fn__7808$G__7784__7815.invoke(io.clj:63)
at clojure.java.io$fn__7896.invoke(io.clj:257)
at clojure.java.io$fn__7808$G__7784__7815.invoke(io.clj:63)
at clojure.java.io$fn__7858.invoke(io.clj:160)
at clojure.java.io$fn__7834$G__7788__7841.invoke(io.clj:63)
at clojure.java.io$writer.doInvoke(io.clj:113)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:602)
at clojure.core$spit.doInvoke(core.clj:6037)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at cljs.closure$output_one_file.invoke(closure.clj:695)
at cljs.closure$build.invoke(closure.clj:795)
at user$compile_cljs$fn__1602.invoke(NO_SOURCE_FILE:55)
at user$compile_cljs.invoke(NO_SOURCE_FILE:54)
at user$eval1613.invoke(NO_SOURCE_FILE:89)
at clojure.lang.Compiler.eval(Compiler.java:6424)
at clojure.lang.Compiler.eval(Compiler.java:6414)
at clojure.lang.Compiler.eval(Compiler.java:6390)
at clojure.core$eval.invoke(core.clj:2795)
at clojure.main$eval_opt.invoke(main.clj:296)
at clojure.main$initialize.invoke(main.clj:315)
at clojure.main$null_opt.invoke(main.clj:348)
at clojure.main$main.doInvoke(main.clj:426)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:405)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:518)
at clojure.main.main(main.java:37)
[done]
17:59:55 :: watcher :: Waiting for changes

The problem was that no resources/public/cljs folder was availiable. It was not entirely clear to me that that was the error, maybe a shout that "the directory resources/public/cljs did not exist" would be of help to someone.

I also wonder what the log message "17:59:55 :: watcher :: Waiting for changes" would mean if it actually found changes and compiled them.

After creating the directory everything seems to work just fine:

$ /opt/local/bin/cljswatch/cljs-watch
18:00:40 :: watcher :: Building ClojureScript files in :: src/ [done]
18:00:45 :: watcher :: Waiting for changes

Maybe a corner case, but if you think it's a useful error to catch, I'll dig into it and send you a patch or something.