This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-08-24
Channels
- # admin-announcements (16)
- # announcements (2)
- # beginners (12)
- # boot (92)
- # cider (1)
- # clojure (149)
- # clojure-argentina (1)
- # clojure-australia (3)
- # clojure-dev (2)
- # clojure-italy (2)
- # clojure-japan (1)
- # clojure-russia (9)
- # clojurescript (48)
- # clojutre (2)
- # core-logic (18)
- # datomic (48)
- # editors (43)
- # emacs (11)
- # funcool (12)
- # hoplon (11)
- # ldnclj (30)
- # ldnproclodo (1)
- # rdf (6)
- # re-frame (13)
- # reagent (10)
- # testing (1)
- # yada (1)
if the reason is to facilitate caching i think that's probably the way to go, rather than arbitrarily configuring :asset-paths etc
That's a solution for e.g. having separate js for index.html and admin.html
doesn't solve anything else, and doesn't work with none optimization
Not sure how Hoplon works but if you have separate html files in the app there, could be useful
I worked on a project at home on an archlinux box and everything worked fine. Now I copied it to my work notebook (win7) and tried running my boot dev
task and got presented with this error
Writing main.cljs.edn...
Compiling ClojureScript...
▒ main.js
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: character to be escaped is missing
java.lang.IllegalArgumentException: character to be escaped is missing
...
clojure.string/replace string.clj: 104
cljs.closure/lib-rel-path closure.clj: 1202
cljs.closure/rel-output-path closure.clj: 1221
cljs.closure/write-javascript closure.clj: 1342
cljs.closure/source-on-disk closure.clj: 1375
cljs.closure/output-unoptimized/fn closure.clj: 1409
clojure.core/map/fn core.clj: 2624
...
Any ideas? here's a bigger stacktrace with my deps https://www.refheap.com/108665
so i tried to collapse our multipage site into a single page and show content based on the (.. js/window -location -path)
for that to work i should serve the same target/index.html*
under every subpage's path.
solution 1: hack the serve
task to send back the same index.html{,.js,.out/}
stuff for any subdir.
this would work for development but not so much for the prerendering task because that uses the temp files directly to load the pages
solution 2: link (or at least copy) all these files under every subdirectory where content supposed to be.
i tried to use the TmpFileSet/cp
function for this but I have no idea how to specify the destination directory (since it have to be a TmpDir)
here are my experiements: https://github.com/exicon/homepage/blob/SPA/build.boot#L33-L41
Hmh, AOT task doesn’t allowing compiling namespaces from dependencies
i could find the relevant files in the fileset:
slash-index-related-files (->> fileset output-files (by-re [#"^index.html.*"]))
so how should i copy them?i saw there is some hashing going on so the file content doesnt have to be duplicated actually
Ah, I can AOT other code if I run aot after uber task
boot.user=> (doc cp)
-------------------------
boot.core/cp
([fileset src-file dest-tmpfile])
Given a fileset and a dest-tmpfile from that fileset, overwrites the dest
tmpfile with the contents of the java.io.File src-file.
i was reading the wiki back n forth regarding filesets and also the boot source code but im not very familiar with protocols and records yet 😞
i didn't understand where file
comes from in the context of (set (map file dirs))
for example:
https://github.com/boot-clj/boot/blob/d8782413a16bfafbc0a069bf2a77ae74c029a5ca/boot/pod/src/boot/tmpdir.clj#L105
i see there is a file
function in the interface of TmpFile but i can quite understand how is it resolved within the definition of another record (`TmpFileSet`)
i tried to write similar code but i was just getting errors so i guessed the interpretation is somewhat special within a record definition...
so when i go to /about-us/
i would get the same content as i get for /
which is the same as /index.html
i was kinda thinking about that but since there is nothing to change on a file, i thought they could just be added somehow to the fileset again but with a different path...
It would solve our immediate problems because the initial startup time is 20s and recompilations are 2s which makes the solution bearable again
Hmm thats something i saw in boot1 the last time... We really need some more solid docs.
i want to switch http://hoplon.io to use ajax crawling instaead of prerendering for SEO
@micha: I didn't use anything that uses regexes (of course deep down something might but no parameter expects a regex compatible string). And the code worked yesterday on a linux pc
@micha: im studying the boot.core
, boot.tmpregistry
, boot.file
namespaces to understand what (sync! ...) would require, but it's just beyond me (without usage examples aka test) 😕
yeah but i need rsync target/index.html target/subpage/
and target doesnt exist yet - i suppose - when the sync! happens
i also dont want --delete
because the assets dir already puts .css files under subpage/
i was trying
(deftask copy-index-htmls []
(with-pre-wrap fileset
(sync! "target/about-us/index.html.out/" "target/index.html.out/")
fileset))
...
(comp (hoplon) (reload) (cljs) (copy-index-htmls))
...
but ls target/subpage/
only contains the asset-dir's content. maybe it's overwriting it?
but never mind, i can see i understand too little about boot, so i wont be able to fix this myself
is there an official way to pretty print a fileset?
im aware of the show -f
task but that's too pretty
i looked at the fileset in sublime and ran a prettify on it and now i understood there is a tmpdir for the file contents with all the files named as their content hashes and the fileset's structure is:
<boot.tmpdir.TmpFileSet{:dirs #{<boot.tmpdir.TmpDir
:dir<java.io.File>
:user<bool>
:input<bool>
:output<bool>
...}
:tree {"path/file.ext" <boot.tmpdir.TmpFile
:dir<java.io.File>
:path<same-string-as-the-key>
:id<hash string>
:time<unixtime>>
"other/file.ext" <boot.tmpdir.TmpFile ...>
...}
:blob <java.io.File which is a tmpdir but not part of the :dirs set>}>
disregard my earlier question; (clojure.pprint/pprint fileset)
is pretty enough actually
@onetom: there is https://github.com/boot-clj/boot/issues/250 out there to improve printing also
any tips on reading stacktraces? Reading this one closely though I don't see any of my namespaces in the error I posted, which would suggest the problem could stem from elsewhere
@xifi: have u tried disabling the cljs-repl or the boot-reload? the topmost lines reference these 2 libs
@onetom: thanks for the tip. With boot -vvv cljs
I still get the same error, with a different stacktrace https://www.refheap.com/108675
u should narrow the issue then. can u create a github repo to demonstrate the issue? or it's reproducible even with an empty src dir?
im trying it on a mac:
> boot -V
BOOT_CLOJURE_VERSION=1.7.0
BOOT_VERSION=2.2.0
#App version: 2.2.0
same version here on a win7. Yes I'll do that, probably tomorrow as I'm out of time for today. Thanks for your help
i've added this to my build.boot:
(require '[adzerk.boot-cljs :refer [cljs]])
and boot -vvv cljs
runs without any errorsI tried running boot hoplon cljs
on the hoplon-minimal github project and it worked. So I'll have to try with my deps and code
Hello boot people , I am working on a little cli tool that uses boot, and i think, that after updating to 2.2.0 I am having truble getting it to run my -main funtion
#!/usr/bin/env boot
(set-env! :dependencies '[[http-kit "2.1.18"]
[amazonica "0.3.28"]
[org.clojure/clojure "1.7.0"]
[bidi "1.20.0"]
[boot/core "2.0.0"]
[cheshire "5.5.0"]
[midje "1.7.0-beta1"]]
:source-paths #{"src/" "test/investigator"})
(task-options!
pom {:project 'investigator
:version "0.2.0"}
jar {:main 'investigator.core}
aot {:all true})
(deftask build
"create a standalone jar file that investigates services"
[]
(comp (aot) (pom) (uber) (jar)))
(defn -main [& args]
(require 'investigator.core)
(apply (resolve 'investigator.core/-main) args))
./build.boot -a
clojure.lang.ExceptionInfo: java.lang.IllegalArgumentException: No such task (./build.boot)
data: {:file
"/var/folders/q7/_rvk3pm567q927xt9f2ps13c0000gp/T/boot.user4481508804275288265.clj",
:line 25}
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: No such task (./build.boot)
java.lang.IllegalArgumentException: No such task (./build.boot)
boot.core/construct-tasks core.clj: 672
...
clojure.core/apply core.clj: 630
boot.core/boot/fn core.clj: 706
clojure.core/binding-conveyor-fn/fn core.clj: 1916
…
@ericfode: I haven’t used boot for scripting yet, so only general ideas… did you try without the -a
?
@ericfode: and a filename other than build.boot
?
not necessarily if you want to run it as a script I think (https://github.com/boot-clj/boot/wiki/Scripts)
I was trying to use the build.boot to define my main function so when i compile it it calls the right main
for reloading a page that uses e.g. reagent there's :on-jsload
in boot-reload. That works fine when I edit a different file than the one containing the initiation function (let's call it init!
). When I edit that file though I get everything running twice as I call (init!)
at the end of that file in order to render the first time the app starts. What would be the solution to this? Running the initiation twice is not good when it has side-effects.
The only thing I can think of is not calling the function at the end and creating another file/namespace that will be the main one and will just render