Hacker News new | past | comments | ask | show | jobs | submit login

I urgently encourage you and anyone else reading this to check out Turbolinks 5, ideally in tandem with Stimulus.

https://www.youtube.com/watch?v=SWEts0rlezA&t=3m22s

https://github.com/turbolinks/turbolinks

https://stimulusjs.org/

You can get all of the benefits of server-generated pages with the speed of an SPA. 90%+ of the sites built using SPAs would be better served by Turbolinks and Stimulus.




I’ve never used Stimulus, but I can concur that Turbolinks is magic, at least for the simpler Rails app I made. It took load times from over one second to feeling like a native app, didn’t require any changes on the backend (it’s enabled by default in Rails), and the site works just fine without it, for those of us who like blocking third-party JavaScript.


Just looked at stimulus. Really cool framework. circa 2008 or so there was this concept of non-intrusive javascript where you bind js to elements. So you could wysiwyg html and then inject js where you need it. Thought that was a neat idea and like what stimulus does it. Any real life experience from anyone ?


Just for context, Stimulus is written by the same people who make Rails, Turbolinks etc - Basecamp. In fact, primary author Sam Stephenson was the author of Prototype, which was the library that inspired the creation of jQuery.

Stimulus and Turbolinks 5 don't have to be used together, but when they are it's a beautiful thing. That's because Stimulus uses the MutationObserver API to observe for DOM changes (eg. loading a new view in response to a click). It is the nicest event handling concept I've ever worked with.


Yes, I'm using it in the budgeting webapp that I develop and here's one little component that I shared, a calculator for input boxes https://tomk32.de/2018/08/04/stimulus-component-calculator.h...

Really should add a gif or something.


pretty cool.. thanks for sharing... I could not work on the app itself, but that is ok.


I've never heard of either before, and they've really caught my attention. Thanks for bringing this up.


Let me know if you need any help getting up and running. I'm not involved but I'm a big fan.

For what it's worth, if you are impressed by the reasoning and design-thinking that created these libraries, I encourage you to try Rails sometime as well. I still consider it the best way to build a web application for 90% of use cases. I'm happy to answer any questions you might have.

https://www.quora.com/Why-do-so-many-startups-use-Ruby-on-Ra...


This all looks really nice - any idea if there's anything comparable that works with Django?


Stimulus will work with any (or no) backend.

Turbolinks will work great with Django, but I recommend configuring your stack to automate the inclusion of the Turbolinks-Location header in your responses.

I just did a quick Google and this came up: https://stackoverflow.com/questions/47240766/to-use-turbolin...

Let us know how you make out!


Turbolinks has out-of-the-box support for Rails, but should theoretically work with any backend without much work. Just install via npm.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: