What are the pros and cons of Asset-Pipeline/Turbolinks from Rails 4 for a big application? [closed]

旧城冷巷雨未停 提交于 2019-12-05 01:11:56

Both are valid tools which do not necessarily cancel each other out.

Turbolinks: Enables you to load only the body of a page, thus making it work as an AJAX request (an example of such a behaviour would be the one Facebook has).

Advantages:

  • Skips the browser task of fully rendering a new page, thus eliminating the "blank page" time where the browser is unresponsive.
  • Related with previous: In case you are having behaviour that might get affected by loading a new page, like let's say, playing a song, turbolinks will not affect it (see soundcloud next).
  • Doesn't reload the document head, therefore not loading the same tags/content twice (if it is the same).
  • Enables you to still cache view content on the server side.

Disadvantages:

  • A drag if header tags really need to be updated (new js files, new css files, metatags update...)
  • If you want to use client-side view rendering, it is just not the tool for it.
  • The default-behaviour to disable the behaviour is just painful (using css classes to disable anchor tags inside a section? that just sucks).

It's actually a question of what the architecture of your app is, what does it target.

About asset pipelining, I have had mixed results with it, even though I'd say it has more advantages than disadvantages. Overall, pre-processing tools enhance cross-browser development productivity, but don't rely on it in production. But in the case of asset pipelining, it has to do as well with what you want it for. You can pre-process SASS, Coffeescript, you have great libraries like compass or bourbon, but this can also increase your performance overhead. So, benchmark it and see whether these should be tools for you.

Hisako

Let's start with a post about the drawbacks: http://eviltrout.com/2013/01/06/turbolinks-and-the-prague-effect.html

If this isn't a problem for you: http://geekmonkey.org/2012/09/introducing-turbolinks-for-rails-4-0/

To wrap things up: Turbolinks will improve your page load significantly if your pages share JavaScript and CSS styling. PJAX comes in handy, when server-side performance is an issue.

  • Hope this helps :)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!