Fork me on GitHub
#hoplon
<
2017-03-13
>
chromalchemy23:03:06

In the Castra template boot.build, why are .clj files in :resource-paths, and everything else is in in :source-paths ?

:resource-paths #{"resources" "src/clj"}
 :source-paths   #{"src/cljs" "src/hl"})

chromalchemy23:03:33

Can i just mix .clj and .cljs.hl files folders in subjectively named folders, and simply do :source-paths #{"src"} and have Castra still work?

micha23:03:24

sure, it should still work

chromalchemy23:03:08

ps. I have all my static assets in "resources". I had trouble getting .css files to load from "assets". But this was a while back. Is that ok? Is using "assets" folder still recommended? I noticed it's not specified in the template.

micha23:03:11

the difference between the :source-paths and :resource-paths is that things in :resource-paths will end up in packaging (like jar files etc) and things in :source-paths will not

micha23:03:37

things in both are on the classpath

chromalchemy23:03:22

only :resource-paths stuff shows up in "target"?

micha23:03:49

or things added to the fileset by tasks with add-resource

chromalchemy23:03:49

Ok. is :asset-paths still a thing?

micha23:03:11

it is, i haven't had a use for it myself yet

chromalchemy23:03:51

So per the first question. Why are .clj files in the castra template in "resources"? You suggested it's not required for the proper war/deployment stuff...?

micha23:03:05

i was just explaining about :resource-paths in boot

micha23:03:50

if you are making a war file for deployment you will want to have the files that will be included in the war have the "output" role

chromalchemy23:03:58

sorry, i meant :resource-paths. Like in

:resource-paths #{"resources" "src/clj"}
 :source-paths   #{"src/cljs" "src/hl"})

chromalchemy23:03:22

Yes. I want to deploy a war file to Heroku

chromalchemy23:03:26

So does that mean I put all my app .cljs, .cljs.hl, & .clj files in :resource-paths ?

micha23:03:28

there are two "roles" a file in the fileset can have

micha23:03:35

input, and/or output

micha23:03:39

or neither

micha23:03:07

if you scroll up a bit you can see how the roles are interpreted by tasks

micha23:03:30

so the war task for example

micha23:03:39

it's a packaging type of task, naturally

micha23:03:54

so it will package up files in the fileset that have the "output" role

micha23:03:29

that table i linked to above shows you which files have the "output" role

micha23:03:45

(that is, "resource" and "asset")

alandipert23:03:28

the reason the template puts cljs and hl in source paths is because those are converted into javascript as part of the build, and there's no reason to deliver them

alandipert23:03:50

vs. the .clj which is both compiled and run on the server after deployment

alandipert23:03:10

probably doesn't matter if .cljs ends up in your servlet tho

alandipert23:03:22

so there's no hard reason not to put everything in resource-paths

chromalchemy23:03:28

Ok. I see the strata of file roles more clearly. And that clears up the Heroku war context for me more. So to paraphrase: .cljs.hl and .cljs is compiled at boot-compile time by (boot-cljs) and (boot-hoplon) tasks and do not need to be packaged for the server-runtime context output-role -> war-file -> heroku:deploy. But in a servlet, there's not much downside to including them (maybe a bit more upload time and war file size). The benefit of this would be to mix .cljs and .clj files in my namespace structure more freely (without re-jiggering the boot.build path declarations).

alandipert23:03:59

👌 sounds legit

alandipert23:03:11

another way to strip them out is w/ sift