This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-27
Channels
- # adventofcode (7)
- # announcements (31)
- # babashka (15)
- # beginners (14)
- # calva (45)
- # circleci (6)
- # clojure (27)
- # clojure-europe (19)
- # clojure-france (2)
- # clojure-gamedev (4)
- # clojure-uk (2)
- # clojurescript (26)
- # conjure (14)
- # data-science (6)
- # deps-new (7)
- # depstar (4)
- # emacs (13)
- # events (1)
- # fulcro (20)
- # graalvm (2)
- # hoplon (30)
- # joker (11)
- # london-clojurians (1)
- # malli (26)
- # pathom (2)
- # re-frame (13)
- # reagent (8)
- # reclojure (3)
- # reveal (8)
- # robots (4)
- # shadow-cljs (29)
- # sql (5)
- # tools-deps (28)
- # vim (4)
Hey, I have a couple of questions concerning templates. Suppose I have some project which I would like to turn into clj-template. It has quite a few namespaces. Currently it's just simple deps.edn project.
I looked at the app
and lib
template and they only contain two clojure files. If my app contains quite a few files is there a way to keep most of the structure without doing so explicitly for every namespace. Essentially I would just like to replace the prefix of every namespace with the app name.
What is the usual workflow when working on a template? Do people just modify it then create a new project based off that template once they want to test it? Is there no way to just keep working on the template without the back and forth of generating a project when I want to test it? Maybe I misunderstood something in that regard?
I have been thinking of using something like clojure.tools.namespace.move
or mranderson
to just rename and move the namespaces in question when generating a new project based on the template, so I can still keep working "as usual" on the template. Is that a bad idea?
@finn.volkel I'm not entirely sure what you're asking about here. The built-in templates are very simple and it's easy enough to have all the template files in a single folder. Most real templates look a lot more like the projects they generate, or at least are organized into folders for related functionality within the template. See the Luminus template, for example: https://github.com/luminus-framework/luminus-template/tree/master/resources/leiningen/new/luminus (that's just the template source files). The "template driver" -- the code that actually generates projects from template source files -- can be as simple or as complex as you want.
@seancorfield I think the main question is if there is there is way to keep working on the template files, containing for example mustache template logic, while also at the same being hooked into a repl session, so that one can test the code I write in the template source files. As I am assuming this is currently not possible, I am wondering what workflow people usually have when working on the template source files. Hope this makes sense now.
@finn.volkel I don't know what workflow people use. I have never actually created any templates. The ones in clj-new
come directly from boot-clj
, with just very minor updates (to use deps.edn
instead of build.boot
) and those in turn I copied from lein-new
(again, with just a minor update from project.clj
to build.boot
). I don't use templates either, except for the very basic built-in ones.