Fork me on GitHub
Stefano Bertoli17:07:42

Hi everyone, do someone knows if there is a way to pass data to a clojurescript project (Reagent) when building from leiningen?

Stefano Bertoli17:07:37

What I would like to do it get the last commit information from the git repo inside the clojurescript project, and pass that information to my project to be able to display it inside the build

Stefano Bertoli17:07:48

The more general question would be if there is a way to trigger some Clojure code when calling a build command like lein package


Maybe there's a more straightforward answer to your questions, but I've used :filespecs to grab git information and package it during lein uberjar


I'm not sure how a clojurescript build differs as filespecs is specifically for adding things to a jar file.

Stefano Bertoli19:07:37

Mmmmh thanks for the answer, I’ll check it out! 😃


@elkiwydev you can pass things to CLJS via :closure-defines


this may be reasonable for some usages


within a :cljsbuild in lein project:

:closure-defines  { ~(find-some-dynamic-build-info)}


And you could do a

(defn find-some-dynamic-build-info []
 ;; lookup things here )
in top of project.clj above the defproject declaration


which in this case, looks like you’d probably be shelling out to git


but it’s pretty open with what you want to do to get whatever information

Stefano Bertoli20:07:36

Thanks @mikerod, I’ll look for that too!

👍 4