Replace jinja2 with angularjs completely

What jinja2 can do, the same thing can be achieved with Angular.js. My question is: are there any advantages of replacing jinja2 with Angular.js completely?

+6
source share
2 answers

I think most of the problems came from the same obvious difference: Jinja2 is server-side, Angular is client-side, this makes them really different.

  • SEO . Google does not understand the magic of Angular. This is just heavy Javascript code, and Google can't figure it out. Of course, you have workarounds to display your important text on Google, but to solve it you will have to display some server parts, returning to Jinja2 or hack things to improve your SEO. (this doesnโ€™t matter if you donโ€™t need Google searches)

  • Performance Server-side submission is much faster than Javascript rendering. I'm talking about your average user, possibly with outdated Internet Explorer and a crappy internet connection. With Angular, you need to wait for at least some Javascript resources to load before the page is used. Users notice this, and we know that a slow site will hit your conversions. Check out this Twitter article about โ€œtime for a first tweetโ€: https://blog.twitter.com/2012/improving-performance-on-twittercom

  • Compatibility . Yes, they claim that the framework supports all common browsers, but has full hacking documentation to make it work for IE7. Depends on your audience.

  • Maturity . Jinja2 is really stable, has a pretty API and is deployed with almost all flash drives. Angular is still evolving, and sometimes things just change a lot.

  • inexperience . You cannot just replace Angular with Jinja2. When you try, you will realize that they are different, and you should not work the same with both. You will make many mistakes before you can fix everything, as with any new amazing tool that you use.

Of course, you can claim all my arguments based on your specific needs, these are just some of the things you need to understand before moving on to Angular.

However, I use Angular in several projects, mainly for single-page applications. This is a great use case for Angular. In all of these projects, I still use Jinja2 for some rendering, so this is not a complete replacement.

UPDATE:

Some updates almost two years after my initial response.

  • Google has a better understanding of dynamic rendering, but I still don't trust it.

  • I don't think client side rendering is a thing. Only real-time data is displayed on the client side, but basic HTML is created on the server side.

  • Angular removed support for IE7 / IE8. This is definitely a good thing for the Internet, but unfortunately, I still need to support these browsers in some cases.

  • Angular 2 is on the go, changing everything you know about current versions. I do not remember any major changes to Jinja2.

+13
source

Why is your goal? Use the capabilities of both Jinja and other server-side frameworks with the power of third-party frameworks.

Advantages of using both:

  • smaller and lighter code
  • better performance
  • easier to maintain
  • and much more. You have a choice.

Choosing one or the other will make your work frustrating and difficult.

+3
source

All Articles