Velcro can be considered an evolution of Chris Wanstrath’s PJAX.
Like PJAX, Velcro is used for seamlessly changing a part of a page instead of reloading and re-rendering a whole new page.
However, Velcro differs from PJAX on some fundamental aspects.
- The true benefit of Velcro is that CSS and JS assets aren’t reloaded nor re-executed. This greatly speeds up rendering.
- Transferring only the piece of content needed (without the layout) is considered micro-optimization. As long as only one HTTP request is made, transferring the extra bytes of your layout is less of a big deal than you might think.
- There is no reason for all this to require the use of
history.pushState
. In any AJAX context, including operations made in browsers not supportinghistory.pushState
, Velcro can be of good help.
- No server-side tweaks needed. Completely drop-in.
- Can update multiple parts of a page at a time.
- Doesn’t require the use of
history.pushState
.
git clone [email protected]:rafBM/velcro-poc.git
cd velcro-poc
gem install sinatra sprockets coffee-script shotgun
shotgun