FUCK ANGULAR 2 ON rails lessons learned
Let’s be honest, the asset pipeline is pretty shitty. I definitely hate it. But sometimes it’s best to accept its existence, move forward, accept it and utilize it.
I’ve spent the last 5 days fighting the asset pipeline attempting to get Angular2 to place nicely with Rails. With all the dependencies and bullshit that comes with Angular2, I found it really difficult to implement into Rails. I had Gulp processes going, I implemented npm, I had dual build packs with heroku, I did ALL SORTS OF BULLSHIT. LITERAL BULLSHIT. Let me save you a few days of time…
RAILS + ANGULAR2 = FUCK THAT, DON’T DO IT
Angular2 gave up on bower. They’re like fuck bower. And I say, fuck angular for that. I used bower to manage my dependencies and switching to npm was a complete pain in the ass. It was always a catch 22 - I do it this way and that f’s something else up.
Why React Kicks the shit out of Angular2
React can be implemented with a simple gem, react-rails. React has very little dependencies.
Then if you add
.es6.jsx and they’ll be transpiled into .js in a form that most browsers will understand.
React is basically built for something like rails. It’s just views. Man, just the views. That’s all we need to fuck with! Where as Angular 2 needs all these various files. Omg, React is just so much more simple.
You can drop react components in your views easily
<%= react_component "ExampleComponent" %>
Easy to use generators
rails g react:component ExampleComponent name:string
Now I can get back to coding and not fucking around with setup!