Question About Statement In Manual regarding :source-paths #950
-
In the manual, it says the following: "It is not recommended to separate source files by extension (eg. src/clj, src/cljs, src/cljc). For some reason this is widely used in CLJS project templates but it just makes things harder to use." But it does not explain the reasoning behind it. As a n00b Clojure developer who is trying to get up to speed on using some of the various build tools which is a little bit overwhelming, I would like to know why. I have looked at Luminus the template structures its created projects in this way. How else would a proposed project with client, server, and shared code be structured in a project that only uses shadow-cljs? Regards. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Well, it is my subjective opinion so YMMV. Template authors do many things that I don't necessarily agree with but that doesn't mean its wrong. I'll likely just remove that sentence entirely but let me expand on it a little bit. Clojure and ClojureScript are both namespaced systems so I recommend keeping things sorted by namespace. I much prefer to have a directory structure like
As opposed to strictly following the rules of split paths and separating them further creating an unnecessary complex directory structure.
Again this is entirely subjective and doing it another way is not wrong. Pick a style you like and stick with it. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response. I was actually thinking along the same lines as you (except I thought of "server", "client" and "shared") but being noob I was unsure of what the "other" or another way should be. A couple of quick questions. Does the "main" folder serve any particular purpose? Is it because there could be another "test" folder at that level? Also, how would say a company name fit in the folder structure to namespace? I've seen that remarked upon elsewhere. Regards. |
Beta Was this translation helpful? Give feedback.
Well, it is my subjective opinion so YMMV. Template authors do many things that I don't necessarily agree with but that doesn't mean its wrong. I'll likely just remove that sentence entirely but let me expand on it a little bit.
Clojure and ClojureScript are both namespaced systems so I recommend keeping things sorted by namespace. I much prefer to have a directory structure like