Fork me on GitHub

We have inherited this old angularjs 1.x project served by ASP .NET framework, I’m not sure where to start on how converting this app and introduce clojurescript to this. Full rewrite does not seem an option, what would you do ? I’m a newbie to cljs


In all honesty, I'd sit back and consider if adding clojurescript is a good idea.


Right, that’s what I’m also thinking :white_frowning_face:. I’ve never pushed cljs in production, I’ve never developed on windows (.net framework only runs on windows). I don’t know how’s the cljs tooling in that OS


> net framework only runs on windows Not entirely true, given the Mono project. .NET landing page explicitly talks about being able to run your apps on macOS and "Supported on Linux, Windows, and macOS" if you scroll down.

😮 3

@U62LF4PT5 is there a support from the customer/sponsor to switch technologies?


@U061C5DAA Not really… there’s limited resources available, maybe we could switch to .net core but that’s about it, we need those projects running. I’m trying out the mono project. Having my usual tools would be a start, I’ll see if I bump into some examples of migration AngularJS to CLJS that don’t involve complete rewrite


I must admit, from what I read that I don’t see a business case for rewriting to CLJS.


Hey all, quick question– is it possible to use (intern) with clojurescript?


No, there is no such thing as a var at runtime in CLJS


I get a "use of undeclared Var intern at line..." when I try it with the cljs compiler


hmm... another question too actually: how shall I check the typeof an object in clojurescript? I want to distinguish whether I'm operating on a number or an an object (map)

Jeff Evans15:09:10

you should be able to use (type thing)

Garrett Everding14:09:55

(def name "Bob") (= (type name) js/String) ;; => true (string? name) ;; => true (not= (type name) js/Number) ;; => true (not (number? name)) ;; => true


👍 thanks!

Jeff Evans16:09:34

Can someone point me to a good project to use as a starting point for embedding a REPL in a browser, which can invoke third party code (ex: com.library/whatever)? I have been playing around with this, but it’s a bit difficult for me to understand how to expose “new” API calls that invoke the libraries:


If you’re using Shadow CLJS, it has a build target called “bootstrap” which handles loading all the dependencies for using the set-hosted ClojureScript compiler. This article explains it a bit: Here’s a minimal working example: There’s a bit of info missing in these two resources about how to get a nice reloaded workflow. I just managed to get that working well, so if it’s interesting, ping me and I’ll tell you more.

Jeff Evans13:09:28

Thanks so much for the details. I actually did have a few issues, even when starting with that project, for what I was trying to do. However, I came to realize that the problem was in the library I was trying to bootstrap (has some macros that need to be reworked to support bootstrap).

👍 3

I notice that, even when I specify :output-to and :output-dir to somewhere other that target/, CLJS compilation still makes files in target/ . Is there a way I can change that? I'm trying to run two separate compilations at once and they're both clobbering target/, when I configured them to output somewhere else entirely.


:output-to and output-dir are the way to change that. The clojurescript webpack guide uses out rather than target and it works. How are you building your clojurescript files?


Is there a ClojureScript compiler option to have output .js files mirror the file/directory structure of the source .cljs files?





> I have both the cognitect.transit-clj and cognitect.transit-cljs dependencies because my project is Clojure on the backend and CLJS on the frontend. This is a really bad idea, causes all sorts of problems. This may be one of them, not sure.


You should have separate sets of dependencies for each, don't try to share them


@U08JKUHA9, thanks so much! I will look into how to split them up.


that doesn't matter at all, just keep both

👍 3

@U05224H0W, Thank you for your SO answer. That fixed it!

👍 3

any other way to dynamically "def" a var ?


(From the ClojureScript article on "Differences from Clojure")


somehow i find that hard to believe. you can do a lot of "dynamic" things in "dynamic" languages (and both cljs and the host language are "dynamic"). it's only a matter of finding out how.


Well you can just do (aset js/window "foo" "something"), of course. But if you really mean var, and you don't trust the official docs, I don't think I can help you


Honestly I think i will just emit a dynamic def with a macro. Thx!


don't do "var" based programming in CLJS. you are in for all sorts of issues if you do. just (def thing (atom "value")) and swap that instead of working on the "var" if possible. CLJS doesn't have vars at runtime and even less so after :advanced. thats where the issues usually show even if everything sort of work in development.