3 ms·
The fact that front end has to deal with 3 different languages (JS + HTML + CSS) is a problem nobody has completely solved. These days the solution usually fal
by pier25 8y ago
The fact that front end has to deal with 3 different languages (JS + HTML + CSS) is a problem nobody has completely solved.
These days the solution usually falls into 3 camps:
1) Write everything in JS like React.createElement or Mithril. No build setup but a pain to use.
2) JSX. Requires a build setup which might become complex as the project grows.
3) Templates. Probably the less elegant of all 3 but the most pragmatic and easy to use.
Someone attempted to solve this and created a new language called Imba. It's like a mutant Ruby with HTML that compiles to JS.
http://imba.io/ http://imba.io/
It has a lot of productivity benefits compared to previous attempts at solving the same problem, but goddammit it's ugly.
- sephoric 8y agoThe project "create-react-app" is a good mixture of #2 and #3 that I have been using for almost a year with almost no issues, it's just a generally great way to use React. The only issue I had is that, even though all your configuration is "for free", you don't really get new features right when they come out. But you get them after their configuration has been polished up, so that you don't have to shave all the yaks yourself.
- pier25 8y agoPersonally I'd rather have my own configuration than use a CLI like create-react-app or Vue CLI. It's easy enough to create a template/starter kit the way you want it and tweak it to your taste. Also when (not if) you get a problem you know what's going on instead of a black box.
- kgwxd 8y agoClojureScript along with any of the various libraries for generating JS, HTML and CSS can get you to a single syntax. Granted, you still have to understand all those things on some level with the addition of learning ClojureScript and it's ecosystem. For me, ClojureScript/Reagent [1] has been a dream come true. It marries JS, HTML and React very, very well. I still use normal CSS because I haven't hit a pain point with it yet, but there's some nice CSS tools that use EDN syntax and get rid of many CSS pain points. So far, I've only been able to use it for personal projects but they're not all small. I work with normal React at work on large projects and I've yet to run into anything I thought would be harder to do if were done with Reagent. [1] https://reagent-project.github.io/ https://reagent-project.github.io/
- pier25 8y agoAll those brackets and parentheses reminded me of the Lisp panel in the "Git the princess" comic. https://toggl.com/programming-princess/ https://toggl.com/programming-princess/ I will take a more serious look at ClojureScript, thanks for the suggestion.
- kgwxd 8y agoI promise, they become practically invisible at some point :) And, usually if you count them compared to similar code in a c-like language, using data/markup from any popular format (xml, json, html), they'll be very close. Definitely far less when it comes to HTML vs. Hiccup. I jump around between C#, JS, HTML, XML, JSON, JSX, CSS, SQL and Clojure all day long. I have to do the non-Clojure stuff a lot more and have been doing them decades longer, after just a few weeks of getting used to it, Clojure would be my first choice.