a project template containing clj, cljs cljc files

449 views
Skip to first unread message

Sunil S Nandihalli

unread,
Mar 6, 2016, 12:25:41 AM3/6/16
to clo...@googlegroups.com
Hi everybody,
 I am trying to port an old project which uses cljx plugin and reagent to use cljc and reader-conditionals. I was wondering if somebody can share a simple template which has clj, cljs and cljc files in it?

Thanks and regards,
Sunil.

Colin Yates

unread,
Mar 6, 2016, 4:15:33 AM3/6/16
to clo...@googlegroups.com
Hi Sunil, I always use
https://github.com/reagent-project/reagent-template. Not sure it
creates cljc out of the box but all you need to do is create a new
directory for your .cljc files and add that to the project
source-path.
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Torsten Uhlmann

unread,
Mar 6, 2016, 4:17:27 AM3/6/16
to clo...@googlegroups.com
Hi,

I'm using a Chestnut based template in my project and it was quiet easy to add cljc support. I never used cljx bevor so I didn't know how hard or easy it would be.

I read that cljc files do not have to live in their own source path but can hang around the other files. For my setup I choose to put them into a separate folder anyway. To add that I added it to the global :source-paths in my project.clj:

:source-paths ["src/clj" "src/cljs" "src/cljc" "dev"]
Then I added it to the :source-path of cljsbuild and uberjar. Here's the uberjar definition as an example, which also contains one cljsbuild conf:

:uberjar {:source-paths ^:replace ["src/clj" "src/cljc"]
:hooks [leiningen.cljsbuild leiningen.sass minify-assets.plugin/hooks]
:env {:production true}
:aot :all
:omit-source true
:cljsbuild {:jar true
:builds {:app
{:source-paths ^:replace ["src/cljs" "src/cljc"]
:compiler {
:optimizations :advanced
:pretty-print false}}}}}})

Hope that helps,
Torsten.

--

Robert Levy

unread,
Mar 6, 2016, 4:32:11 AM3/6/16
to clo...@googlegroups.com
Reagent-template may have improved recently, but the last time I checked, about 5-6 months ago, I found it to be seriously misleading and outdated in a number of ways in its opinions on the state of the art for clojurescript tooling.  The template I found to be the best was the figwheel template.

Colin Yates

unread,
Mar 6, 2016, 4:33:00 AM3/6/16
to clo...@googlegroups.com
Quite right - they don't need to live under their own directory. Other
than for libraries however, I do find the /clj, /cljc, /cljs structure
quite pleasing and clean.

Colin Yates

unread,
Mar 6, 2016, 4:33:59 AM3/6/16
to clo...@googlegroups.com
Not sure about now (as it has been a while since I used it but yes, I
always find `lein ancient` a good first step :-).

Sunil S Nandihalli

unread,
Mar 6, 2016, 5:14:19 AM3/6/16
to clo...@googlegroups.com
Thanks Colin, Torsten and Robert.
After looking around a little more I did realise that cljc files can just be added without a place for the generated like in cljx. I did actually endup checking out reagent template. I think I now have a reasonable idea and I am making progress. Thanks everybody for the help.

Regards,
Sunil.

Zach Oakes

unread,
Mar 8, 2016, 7:08:58 PM3/8/16
to Clojure
For those looking for such a template for Boot, check out my example project:

Reply all
Reply to author
Forward
0 new messages