5 ms·
It seems to me that setting up clojurescript project is extremely easy. Basically you need to know only one "build" system(leiningen/boot), as for javascript yo
by jyriand 10y ago
It seems to me that setting up clojurescript project is extremely easy. Basically you need to know only one "build" system(leiningen/boot), as for javascript you would have to know at least few(broccoli/npm/bower/gulp etc). And with leiningen you can do `lein new` as well, although I prefer boot and creating my own files:
├── README.md
├── build.boot
├── resources
│ ├── index.html
├── src
│ └── cljs
│ ├── sample
│ │ ├── core.cljs
│ └── main.cljs.edn
└── test
└── cljs
└── sample
└── core_test.cljs
- fnordsensei 10y agoBut then you at least want Figwheel in there, and it's not necessarily easy to know how vastly better your life will be with it if you've never done cljs before. It would be neato with a cljs IDE for approachability. An MVP could be lein + cljs + figwheel + lein ancient, editor + webkit viewer.
- likeclockwork 10y agoI'm late to the party but since the poster only showed us the tree we don't know what else is going on in that build.boot. boot-http, boot-cljs, boot-cljs-repl, and boot-reload Provide all the features of lein-ring, lein-figwheel, and lein-cljsbuild with a simpler setup and no clojure neccessary in a clojurescript project. Serving compiled clojurescript, reloading cljs and css, with a browser repl, is really simple in boot. The boot tools work together better than the leiningen tools do. If you look at the Tenzing template's build.boot, which doesn't have a lot going on, you'll see how straightforward the meat of it is, without ending up with other JVMs. https://github.com/martinklepsch/tenzing/blob/master/resources/leiningen/new/tenzing/build.boot https://github.com/martinklepsch/tenzing/blob/master/resourc... lein new tenzing some-project emacs some-project/build.boot M-x cider-jack-in // switch to repl: (boot (dev)) M-x cider-replicate-connection // switch to new repl (start-repl) That's it. The first repl gives you feedback on the dev server and reloading. The second repl gives you a browser repl. Cider has also levelled up, such that when the browser repl connects it gets picked up by nrepl and just works. All of this with one JVM... and no Clojure sources in your ClojureScript only application. I stress again that the template really doesn't do a heck of a lot and the build.boot, the filesystem layout, and the way boot works is really the whole of the story. I wish Boot were better documented/marketted, so I could've switched to it long ago.
- hkjgkjy 10y agoBoot is great. I'm not an idiot developer, and have accomplished quite a few things with code that I'm proud of. But please don't ask me how to setup nrepl with boot+cljsbuild and have the repl run in a browser or on node. I am heavily thinking of implementing a language that is inspired by Clojure, but native to the JS land. It would use npm, Mori for data structures and browserify (if not on Node.js) under the hood for requiring libraries. Basically a transpiler from Lisp style code to JS, with better data structures.
- danenania 10y agoThat sounds like it would be an awesome language! I love cljs but often share the feeling that its implementation is too heavy and too far removed from JS.
- unwind 10y agoAs an (embedded at the moment, but I've been around) C and sometimes C++ developer, considering that tree to be "easy" just seems absurd. I'm sure everybody knows this, but here's "hello world" on the command line using GCC in e.g. Linux: $ echo -e '#include <stdio.h>\nint main(void) { printf("hello, world!\\n"); return 0; }' > hello.c && gcc -o hello hello.c && ./hello The most complicated thing here is probably the bash quoting/escaping (which explains the double backslash inside printf()'s arguments). The above command line spawns two processes, one of which is a full C compiler, and it runs in 3 milliseconds on my embarassingly old home laptop (Core-I5 M480 at 2.7 GHz). I'm not trying to be the old fart claiming that everything was better back in the day, but this (to me) almost makes C seem as approachable as BASIC on the old 8-bit machines, when looking at the relative complexity.
- pathsjs 10y agoExcept when you want to add a dependency. Then things will not look nearly that simple...
- swannodette 10y agoCompiling trivial programs with ClojureScript is equally trivial: java -cp cljs.jar clojure.main -e '(require (quote [cljs.build.api :as b])) (b/build (quote [(ns foo) (js/console.log "Hello world!")]) {:optimizations :advanced})' But I'm not sure this is actually telling us anything.
- mlakewood 10y agoI think comparing the compilation of a C hello world program to a web-project, with inbuilt test scaffolding, serving of generated content, communication across a network and safe multi-threading of the network stack is a little bit of a mismatch. If you build a C project with all of that in it, I think that it would be a bit more than a 1 liner, and it would take a little while longer to compile. Sure not as long as the clojure project to compile but not 3 milliseconds.
- barrkel 10y agoThat looks very hard like it's trying to be a Maven project.