News for hackers. Stuff that matters.
Re:Vue.js 2.1 Released by myf01d on Wednesday November 23, 2016 @10:55AM (#13023433)
I am sorry if this sounds too ignorant, are frameworks like Vue.js (I actually read the guide and understood some wonderful things about its philosophy since I am actually developing backend mainly) or React, etc.. reasonable to use in websites in general (instead of jquery or taking some tasks from it) or they actually only reasonable for mobile web applications and SPAs?

What about the SEO and search engine rendering to custom HTML elements like in Vue.js components? is it okay or affects SEO?

Re:Vue.js 2.1 Released by untog on Wednesday November 23, 2016 @12:36PM (#13024177)
I can't speak to Vue, but React is overkill for many sites. The virtual DOM etc is incredibly useful for sites that update the page very frequently, but if the only thing you're making is a static site and a contact form, you don't need React.

That said, I do like the React model of creating components (and suspect this is why so many people use it when it's unnecessary). I'm looking forward to browsers implementing custom elements so that we can all compinentise this way without the overhead of a large JS framework.

Re:Vue.js 2.1 Released by dalailambda on Wednesday November 23, 2016 @05:30PM (#13026307)
While the virtual DOM is a component in React's popularity, the main thing that I believe people use it for is the functional, one way data flow it allows you to use combined with the component model.
Re:Vue.js 2.1 Released by spankalee on Wednesday November 23, 2016 @05:28PM (#13026299)
Chrome, Safari, and Opera (because of Blink) have implemented Custom Elements and Shadow DOM. Firefox appears to be working on it, and for Edge it's high priority, so things are coming along nicely :)

edit: The polyfills are also very viable. I know sometimes people knock polyfills, but they're really just libraries that implement the component model and encapsulation that frameworks generally have to, but they go away over time.

Re:Vue.js 2.1 Released by enkrs on Wednesday November 23, 2016 @12:10PM (#13023976)
Not in websites per-se, but even the simplest contact/enquiry web form/wizard with some validation/interaction is a breeze to program in Vue.js compared to jQuery.

We have multiple internal enterprise applications where both jQuery and Vue.js are available. More often than not, when there's a pull request, even for the simplest UI interaction, it can be refactored to few lines in Vue.js from the jQuery event and DOM mess. We plan to move away from jQuery in a year or so, and no new jQuery plugins are allowed.

Vue.js has also allowed us to iterate much faster on complex UI than it would be possible with jQuery.

For bigger apps, you can add components, and for even bigger - add Vuex. Vue.js (same as React) really is the new jQuery.

Re:Vue.js 2.1 Released by zihotki on Wednesday November 23, 2016 @11:16AM (#13023602)
From personal experience for general web-sites like blogs, etc. it's better to do them old way, you don't need to worry much about seo, caching, precompilation, etc. But business apps huge community-like ones, and big shops benefit a lot from frameworks like that. But you should always base your decision on cost of implementation, support, etc.
Re:Vue.js 2.1 Released by myf01d on Wednesday November 23, 2016 @11:30AM (#13023695)
Thanks, I am more interested in developing social websites with modern look and more performance, I mean like the design of medium.com or hashnode.com, I think they do render the first page fully canonical HTML, and then every subsequent request is rendered using the js framework GETing some JSON which gives more space to the server to do other work.

I am really interested in this approach but I fear about the SEO and any additional unnecessary complexities like compatibility with old browsers and OSs especially in Android.

Re:Vue.js 2.1 Released by angry-hacker on Wednesday November 23, 2016 @01:10PM (#13024463)
Take a look at russian vk.ru

It's lighting fast compared FB and does all the same things. Really neet. FB makes my laptop literally over heat.

Re:Vue.js 2.1 Released by kimshibal on Wednesday November 23, 2016 @12:27PM (#13024114)
If you fear about the SEO, start with Turbolinks.
Re:Vue.js 2.1 Released by snarkyturtle on Wednesday November 23, 2016 @12:03PM (#13023927)
React in particular, however, was specifically made to handle the state of just parts of the UI on Facebook (like notifications). You could build out a static site but let React handle something more complicated and it'll work just as fine, if not better.

It just so happens that the extensibility around React led to stuff like redux and react-router that's perfect for SPA's, but at its core it's just a View layer that could live alongside a traditional site.

Re:Vue.js 2.1 Released by zfedoran on Wednesday November 23, 2016 @11:08AM (#13023541)
Both Vue.js and React allow you render HTML on the server side. This helps get the first render out quickly where the browser can pick up the state and continue from there.

https://vuejs.org/v2/guide/ssr.html

Re:Vue.js 2.1 Released by Tade0 on Wednesday November 23, 2016 @11:12AM (#13023573)
As it usually is in this industry, the answer to this question is: "it depends".

There's a point, where using jQuery alone just won't cut it.

I guess a rule of thumb here would be: If you're providing a service that requires an account - you probably need something more than jQuery.

Re:Vue.js 2.1 Released by St-Clock on Wednesday November 23, 2016 @11:06AM (#13023517)
In vue.js, SEO is taken care of with with server side rendering[1].

This assumes that you are using node.js as your backend though.

[1] https://vuejs.org/v2/guide/ssr.html#SEO

Re:Vue.js 2.1 Released by chrisbraddock on Wednesday November 23, 2016 @02:46PM (#13025261)
Only that node can talk to your backend right?
Re:Vue.js 2.1 Released by Can_Not on Wednesday November 23, 2016 @09:51PM (#13027640)
I haven't heard of Laravel getting SSR yet, so yeah.
Re:Vue.js 2.1 Released by cstejerean on Wednesday November 23, 2016 @12:01PM (#13023909)
What I like about Vue is that it makes it is very easy to use it as a component of a larger website or non-SPA application. You can use it where you would otherwise use jQuery in order to build widgets or interactive components. It makes it very easy to drop it into a page without a lot of ceremony (no flavor of the month build tools or exotic precompilers are required to get started).
Re:Vue.js 2.1 Released by truth_sentinell on Thursday November 24, 2016 @10:11AM (#13030679)
What would be better o build in terms of code clarity, performance and some other var I can't thin of rn, a slideshow in JQuery or using Vue.js?
Re:Vue.js 2.1 Released by SeanAnderson on Wednesday November 23, 2016 @12:06PM (#13023951)
In the past I've used https://prerender.io/ with a Backbone + Marionette website. You configure your .htaccess (or similar) to direct web crawler's to prerender.io's cached representation of your website. Works great and completely side-steps the issue of SEO for dynamic websites.
Re:Vue.js 2.1 Released by true_religion on Wednesday November 23, 2016 @05:01PM (#13026126)
Google will index sites that render their pages through Javascript. There are two caveats to be aware of:

1. It drops out if it takes more than 5 seconds to complete its operation and uses whatever is render then.

2. Indexing with HTML happens in near-realtime. Indexing with JS to HTML is delayed by about 1-5 days depending on the popularity of the site.

So if you're serious about it; you ought to heavily include metadata for Google to index during the first run through or place a bare bones HTML copy down.

Re:Vue.js 2.1 Released by Yokohiii on Wednesday November 23, 2016 @07:38PM (#13026994)
Proof?
Re:Vue.js 2.1 Released by k__ on Wednesday November 23, 2016 @11:23AM (#13023652)
I can't find the article yet, but a few months ago I read that only some chinese search engines had problems with that. The big ones didn't care much.