Great, another 60KB library (not including dependencies!) that can replaced with a few lines of plain Javascript without any dependencies.
Intercooler.js – Simple AJAX Using HTML Attributes
11–20 of 53 posts
Re: Intercooler.js – Simple AJAX Using HTML Attributes
#12This is fine if you build a website or a small app. But I wouldn’t recommend this approach for a more serious/big app. You will end up with unmaintainable soup.
You would maintain most of your HTML, routing logic, etc. server side.
Re: Intercooler.js – Simple AJAX Using HTML Attributes
#13I also encountered some bugs when mixing the 2 during a transition phase that broke my requests. If I had to start over again I would only use Vue starting with the drop in JS library (no webpack/preprocessing)
Re: Intercooler.js – Simple AJAX Using HTML Attributes
#14Re: Intercooler.js – Simple AJAX Using HTML Attributes
#15Then I realized we could do that easily with a JS library! We could give some divs a "sticky-id" attribute, so they stay as part of the DOM tree when the page reloads, only their contents get replaced with the contents of divs from the new page having the same "sticky-id". That way there's no flash to white, and CSS transitions on sticky elements get a chance to fire. The whole thing could be handled by a generic onclick handler on each link. And the links would support opening in new tab as well, the JS would only fire when they are clicked in the same tab. I think that would be the most conservative way to have an SPA-like experience with a minimum of JS. Unfortunately I was too lazy to implement it :-/
EDIT: It's interesting that most replies to this comment seem to talk about whole page transitions, like fading out the whole page. But as I envisioned it, the key part of the idea is that we can get element-by-element transitions without writing custom JS, just by adding "sticky-id" attribute to some elements and letting their CSS transitions do the work.
Re: Intercooler.js – Simple AJAX Using HTML Attributes
#16Sometime ago I had an idea that SPAs exist mostly because animated transitions between pages make managers happy, not to serve any actual user need. If that's true, maybe we could add support for animated transitions between server-side rendered pages, and make SPAs mostly go away. Then I realized we could do that easily with a JS library! We could give some divs a "sticky-id" attribute, so they stay as part of the D…
Re: Intercooler.js – Simple AJAX Using HTML Attributes
#17Sometime ago I had an idea that SPAs exist mostly because animated transitions between pages make managers happy, not to serve any actual user need. If that's true, maybe we could add support for animated transitions between server-side rendered pages, and make SPAs mostly go away. Then I realized we could do that easily with a JS library! We could give some divs a "sticky-id" attribute, so they stay as part of the D…
https://github.com/turbolinks/turbolinks is pretty close?
Re: Intercooler.js – Simple AJAX Using HTML Attributes
#18Sometime ago I had an idea that SPAs exist mostly because animated transitions between pages make managers happy, not to serve any actual user need. If that's true, maybe we could add support for animated transitions between server-side rendered pages, and make SPAs mostly go away. Then I realized we could do that easily with a JS library! We could give some divs a "sticky-id" attribute, so they stay as part of the D…
Re: Intercooler.js – Simple AJAX Using HTML Attributes
#19Sometime ago I had an idea that SPAs exist mostly because animated transitions between pages make managers happy, not to serve any actual user need. If that's true, maybe we could add support for animated transitions between server-side rendered pages, and make SPAs mostly go away. Then I realized we could do that easily with a JS library! We could give some divs a "sticky-id" attribute, so they stay as part of the D…
Various page transitions can be set using `defaultPageTransition`: https://demos.jquerymobile.com/1.4.5/transitions/
Click the "page" button to the right of a transition for a demo.
Re: Intercooler.js – Simple AJAX Using HTML Attributes
#20Great, another 60KB library (not including dependencies!) that can replaced with a few lines of plain Javascript without any dependencies.
It's 10KB gzipped (30KB non-gzipped) + jQuery. And that is pretty much everything you need.
I wouldn't call Intercooler heavy, au contraire.