I wanted to try these (for me) new technologies on a simple toy project. But most of them just seem so immature in their tooling and/or concepts, it’s sad, I really wanted to like them.
I was planning to use now pretty standard WebPack, but there is no loader for ClojureScript. This should have been my first cue to stop right here. But I wanted to do the project in this stack, so I went for Gulp with some dubious plugin. The plugin was broken and I ended up having to setup Leiningen build (for ClojureScript) to be launched by Gulp. It wasn’t straightforward, because one Leiningen plugin for ClosureScript was partly broken (did not work with :preload) and also I knew very little of Clojure, after all this should have been a project where I was going to learn Clojure a bit more. Launching a binary from Gulp, what an ugly solution, nevertheless working. Next thing was Pug (renamed Jade HTML preprocessor). That was easy, just a Gulp plugin which was working without any issues.
And now I am starting with Vue, oh my. No way to load templates from files, only way is to have them in a string? There has to be a better way… Well, there is - .vue files. But you have to use WebPack or Browserify to process your JavaScript code. Which in my case is being compiled by ClojureScript compiler, so I would have to do some complex workflow ClojureScript compiler -> Pug compiler -> Browserify (or WebPack with Gulp? nasty). Also I could never have everything in a .vue file, because ClosureScript compilation is not trivial - it uses its own module system. Meh, for a toy project this got so complex that even my Angular 2 application which I am developing at work could envy.
I like the Pug a lot, but it does not inspire confidence when a second example I tried from a Vue tutorial broke it.
1 | article-preview(v-for="article in articles" :key="article.id" v-bind:article="article") |
Code above should be accepted by Pug, but it is not. One has to use a comma before attribute which starts with a colon, what a trap.
Well, even if I got it by some miracle working, the ClojureScript compiler is very slow - in dev mode with virtually no code it takes over 10 seconds to compile. I fear that anything bigger than hello world will be a major pain.
Also interacting with Vue is incredibly verbose to a point I wish I was using JavaScript. All those redundancies - js-obj wrapper, need to pass property names in strings, weird addressing of Vue object. Just look for yourself:
1 | (def app (js/Vue. (js-obj "el" "#app" |
Which could be roughly translated to JS like this:
1 | const app = new Vue({ |
I don’t think anyone should be using VueJS with ClojureScript, not until there is some wrapper library. And not until there is a comfortable way of building whole thing, like a nice starter project (scaffolding) or WebPack loader for ClojureScript.
Not everything was bad, Pug was a nice and concise way of writing HTML and the new Gulp 4 nicely solved a lot of things which were previously covered by several plugins. I hope all these tools will improve to a point where the project setup will be easy and they will work together almost seamlessly.
/rant over