Fork me on GitHub

@martinklepsch checkout status-react


Hi guys, sorry if you get this question often, but is Clojurescript really suitable for beginners? I know basic JS and basic Clojure (from a book), but have never coded. I want to make a web application from scratch. Is Clojurescript most suited to experienced developers?


There isn't much in the way of newbie-oriented documentation and tutorials out there with Clojurescript, so I'm worrying it's just too difficult to figure out how to go from zero to app, versus the more popular tech stacks.


@max675 There isn't a huge amount of difference between Clojure and ClojureScript, so most of the Clojure learning materials will apply (apart from JVM interop)


@danielcompton It's just hard to figure out what I need to learn. I've been studying pure Clojure via Clojure for the Brave, and the koans. Now what? With JS, there is a lot of material for guiding you from zero to a working app


As far as CLJS learning materials, there are some good ones out there (, Lambda Island)


But you're right that it's not as rich as say JavaScript


What should be my next step after I am comfortable with Clojure language basics? @danielcompton


I'm a little bit biased, but you could take a look at re-frame's docs, they're top tier IMO


Hey, does anyone who has been using node-modules have any idea how I would require this

Anthony Ciacci14:12:03

Hey! I started exploring this issue last night, but didn’t get very far unfortunately. Dunno if you came across this link, but perhaps it might help?


I’ve tried :blueprintjs-core and :blueprintjs/core, neither work :@blueprintjs/core causes an error with lein immediately


@danielcompton I'll check it out 😁


@max675 I’d check out Reagent, and look at the source code for projects like re-com or zetawar


Also, @timothypratley has a lot of great posts on his blog and youtube channel


its helpful to have some background in JS, but I think CLJS is a great first language


So, um, I can check those out and then... ? They have docs for how to use them, that a newb could understand? I've found most docs to be aimed at people already using JS and JS frameworks.


Build something


deploy it with


I use firebase for all my backend needs


Look at the reagent project for basics


I’m not suggesting you use those projects, I’m suggesting you try and read their source code


key is to have a project you want to build, then figure out how to build it


Reagent is alot friendlier than react


I'm finding the readme on @danielcompton’s Re-frame to be helpful, especially the six-domino analogy. What an event is, that an event-handler is, and so on.


I've learned how to use Clojure to make little programs that are typical of coding tutorials. When I look at real project source code, however, I find that the complexity immediately confuses me. I can't tell what the code is doing, especially because it usually refers back to functions in other files. So I can't find a link between what I learned in the "pure" form, and these applications.


Re-frame is a great library and will give you some great patterns. I definitely empathize with your current challenge. My suggestion when reading other people’s code would be to write down all things you don’t understand, by hand, in a notebook, and try and figure out what is important to understand. Personally, reading the zetawar code was one of the best learning experiences I’ve ever had, but it took quite a long time.


Just like you wouldn’t read The Odyssey in a night, I wouldn’t expect that you could read and understand someone elses code in a night


also, 4clojure problems are great, but they won’t help you build apps, just learn the clojure idioms


if it isn’t hard you aren’t growing


Sure, I'm not expecting to really be functional for another 6 months


I'd like to get there in six months though


I’d suggest trying to pick something you want to build, then going piece by piece to build that


I love firebase because it allowed me to not have to worry about setting up a server, just could focus on cljs


here is a project skeleton I’ve used for starting new projects using datascript and firebase. Might be something helpful there


but definitely recommend zetawar as best course of study


Feel free to PM if you want advice on how to approach a problem, once you know what you’re trying to build


also, recommend reading Polya’s How to Solve it


I'll check out firebase. I'm actually okay with Linux and setting up servers, but anything that reduces the cognitive load is welcome. I'm looking at zetawar now. This looks way more complicated than what I want to do. I'm just trying to do a CRUD app, a jobs listing website.


cool, then take a look at integrant


you don’t need re-frame


let's say (because it's true) that I have a clojurescript library using lein-cljsbuild, and would like to quickly iterate on some tests using a repl is there a straightforward way to start a nodejs repl? I'd rather not bother with a browser if possible.



(require '[cljs.repl :as repl] '[cljs.repl.node :as node])
(repl/repl (node/repl-env))


hmm; fighting with cljsbuild now, but that's a good start. thanks!


@max675 I’ll second using firebase - I’ve played with it a lot on the JS side - and it’s very easy to make something functional with it. Otherwise I’m kind of in the same boat - wanting to learn some clojurescript, but intimidated by the getting started. On the other hand, a couple years ago I went from never having seen a front-end framework before to being pretty competent - so just dive in! I’m making my way through the “modern-cljs” tutorials right now - expecting that’ll get me rolling.


@gfredericks if you’re using the new brew clojure tool you don’t even need that


@gfredericks nothing specific about new clj tool here - valid for lein run too, but it also depends on whether you’re expecting nREPL


I don't need nREPL; mainly just a way to reload changed code (by hand if necessary) and re-run a test


does the tactic mentioned in the tweet allow me to include the source code for the library as well?


(i.e., use the code on the filesystem rather than a released jar)


yes just add to classpath


Hi, How to make Leiningen to use Clojure as well as Clojurescript in a project. For now it tries to search for ":require " as .cljs, but I have them as .clj . I presume that would be a plugin or something like that

Roman Liutikov15:12:26

Have anyone tried deps.edn with Figwheel? I’m having issues with starting the build.


@vienas00 .cljc extension is required


@roman01la should work, makes me think that Figwheel should provide a main method for command line usage \cc @bhauman


but they are external dependencies like [com.taoensso/sente "1.11.0"] contains taoensso/sente/server_adapters/http_kit.clj, but lein complains No such namespace: taoensso.sente.server-adapters.http-kit, could not locate taoensso/sente/server_adapters/http_kit.cljs


it wants that "s" from jar...

Jakub Holý (HolyJak)15:12:46

Hello, what do people use to exchange data between Cljs frontend and Clj backend? Json? Edn? Transit? Anything else? Need to pick something for our app. I guess json is a good choice if we dont use dates, sets & other advanced data, right?

Roman Liutikov15:12:23

@dnolen @bhauman I’m running it with clj --init dev/watch.clj -r with the following config

(require '[figwheel-sidecar.repl-api :as ra])

  {:build-ids ["dev"]
   [{:id "dev"
     :figwheel true
     :source-paths ["src"]
     :compiler {:main "example.core"
                :asset-path "out"
                :output-to "out/bundle.js"
                :output-dir "out"
                :verbose true}}]})

and getting this error Unable to find static field: FUNCTION_PARAMS in class, compiling:(cljs/closure.clj:100:1)


@holyjak I have only used JSON so far, and not experienced any problems.


@roman01la just sounds like a bad Closure dep - maybe make it explicit?


@holyjak EDN/Transit is pretty common

Roman Liutikov15:12:10

@dnolen like this?

{:deps {org.clojure/clojurescript {:mvn/version "1.9.946"}
        figwheel-sidecar {:mvn/version "0.5.14"}
        org.clojure/google-closure-library {:mvn/version "0.0-20170809-b9c14c6b"} {:mvn/version "v20170910"}}}
didn’t help


there’s definitely something wrong with your closure-compiler dep


check the classpath and make sure everything matches

Roman Liutikov16:12:09

checking now…

Roman Liutikov16:12:05

@dnolen you are right, somehow an older version of sneaked in

Roman Liutikov16:12:43

is that bc is not in clojurescript’s deps?


this has an interactive tutorial


that you can work through, to get a small example full-stack app running


@gfredericks An exaple of what David was saying with respect to the new clojure tool: For test.check, if you put this in deps.edn at the top of the tree

{:deps {org.clojure/clojurescript {:mvn/version "1.9.854"}}
 :paths ["src/main/clojure" "src/test/clojure" "src/target/cljs/node"]}
Then you can clj -m cljs.repl.node an you are in a working node REPL that can use test.check code.


@mfikes how about for reloading a file when it changes?


general clojurescript question - what's the most common idiom for replicating :hover - do people just do it in plain CSS, or is there some clojurescript-y way for me to define that stuff inline?


@gfredericks (require 'some-namespace.core :reload)


use onMouseOver?

Roman Liutikov16:12:44

it’s doable, but on-mouse-enter & on-mouse-out is more robust


@gfredericks By the way, the :reload and :reload-all flags are just like in Clojure.


@mfikes excellent, thanks


what's the state of code splitting in cljs? would you recommend it? does it require a lot of attention/care to implement/maintain it?


@vemv I have been using it for 4+ years so very stable and definitely recommended. also very easy to implement/maintain


just a tad different architecture wise if you are used to webpack-ish code splitting since we do this statically in CLJS not dynamically


@thheller precisely the kind of feedback I was looking for 🙂 appreciated, thanks


@thheller is there a way to code split into a bundle of dependencies (which change not so often) and the app (which changes more often)?


@danielcompton vendorization is possible with you enable a reuse names flag to Closure - shadow-cljs already supports it, far as I can tell it’s trivial patch for anybody who wants to add it to ClojureScript generally


Oh that’s super exciting! I was always a bit disappointed that code splitting couldn’t be used that way, great to hear that this is within reach 🙂


These ones? --variable_map_input_file, --variable_map_output_file, --property_map_input_file, --property_map_output_file.


> is there a way to code split into a bundle of dependencies (which change not so often) and the app (which changes more often)? I was wondering the same. we have an monolithic project big enough to get 90-120 second initial compilation times (unoptimized). and pretty slow CIDER... it doesn't seem obvious how to split the project in a way that is productive/pleasant to develop and will perform well in production

danielcompton22:12:24 is the ticket, but after that I think there will need to be some good docs explaining how to set this up


@danielcompton yes but we can also supply a much simpler option that takes care of the details for you like :stable-names I left a comment in the ticket about this


Cool, that makes sense, thanks!


@vemv splitting largely depends on the needs of your app so its hard to come up with general advice. Sometimes it make sense to just “vendor” out “rarely changing” code and sometimes it makes more sense to split code by actual sections of your site (ie. base, shop, user-panel, etc), maybe even combined with “vendoring”


@danielcompton this is pretty much all the code required, + actually calling the functions before and after compilation.


thanks for the input!


I'm familiar with the concept of "vendoring out rarely-changing code", but I'm not 100% sure if that is synonymous with introducing Closure Modules. Is it? IOW, can I use Closure Modules as a means of getting faster compilation times, leaving aside the user-facing benefits (however desirable)?


if you want faster compilation times use shadow-cljs but no closure modules will not make your compilation faster.


closure is built around whole program optimization so it needs your whole program as input


splitting only happens after compilation, can’t do a partial optimization


nice! good guidance I was looking at shadow-cljs just now. where does it strength lie? can it get me things otherwise impossible with lein-cljsbuild + fighwheel? (that's my current stack; my understanding is that s-c competes against both)


faster compile times by far more aggressive (and robust) caching for one


I can’t really do a fair comparison since I haven’t used figwheel ever and cljsbuild not for 4+ years


but I think it does everything they do, if not let me know 😉


big focus is on easier configs with better defaults so half the stuff you need to configure in those tools goes away


big downside is docs …


ace. will try out and let you know. the report from my team's project (~800 cljs files including tests) will make a pretty interesting comparison 🙂


indeed, feel free to ping me with any questions. things are quite a bit different due to the full npm integration


Oh that’s super exciting! I was always a bit disappointed that code splitting couldn’t be used that way, great to hear that this is within reach 🙂