-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can Gridsome do anything that Nuxt can't do? #193
Comments
I don't think we can compare Nuxt and Gridsome based on what they can do. It's how you create a website that is the main differences between them :) |
this question is little ambigous |
Okay let's elaborate on that because I'm also interested as I'm only used to Nuxt and have problems to find the answers to my questions.
|
While Nuxt is a great framework and configurable to create anything you want, Gridsome is more focused on websites that contain mostly static content. We try to solve common problems for most use cases; Source plugins make it easy to use content from CMS'es (more plugins are coming). And a GraphQL data layer lets you easily access the data in any component. All routes are rendered automatically, including dynamic routes. Pagination for collections and taxonomy pages can be implemented with just a few variables in your query. Local images can be optimized automatically and lazy-loaded in the browser. All this can be achieved without writing any logical code. You can use the Data Store API to insert data from custom APIs, but we are going to open up methods for more advanced usage before a When statically generated, the app only contains |
Like what @hjvedvik said, Gridsome tries to simplify building modern, static websites for any data source. To compare Gridsome and Nuxt you also need to compare it to The biggest difference between is probably how you work with data. In Nuxt you fetch directly from APIs per route. This can be from an external rest API or GraphQL API. It’s up to the developer on how to do this. For example, to create a blog with pagination in Nuxt you’ll need to:
The biggest problem with Nuxt (Generate), in my opinion, is that it always fetches from the API on client-side after page load, even if it's static. I know they are working on fixing this, but this is how it is now. There could, of course, be some quick fixes for this. In Gridsome you fetch all data at build time, or when starting development server, into an internal GraphQL data layer and THEN you start adding data to pages from this data layer with GraphQL queries. You don't need to deal with any API endpoints. Data source plugins are designed to make it as easy as possible to add and work with data in Gridsome. For example, if you connect to a WordPress site you can get posts, categories & tags connections out-of-the-box. To create a blog in Gridsome you’ll need to:
Gridsome should also generate pages faster because of how it fetches data up front instead of per page. |
thanks everyone. this is very helpful. could be some useful content to distill into docs one day! |
Thanks for the details. Very helpful. I also see potential putting this comparison to the README. I still feel like these two can be compared, even generate in Nuxt is only a very very small part of its feature set. It comes with so many built in performance centered features that at least for me it needs quite something to get me hooked up to something else.
Maybe the Nuxtent Module I use in my case is intercepting this behavior, but at least it doesn't load again client-side on first load for me. Only on routing. I guess we can say the biggest advantage of Gridsome really is the data connectors, as in Nuxt you have to do it manually or create something on your own, that works for static generation but doesn't put the whole data into your JavaScript chunks. And here it gets tricky, because that means you have to know quite something about Webpack to extend that part. Or you try to find an existing module for it but in my experience it's hard to find one that is enough extended and has frequent maintenance. Somehow I would love to be able only using the data layer features of Gridsome, but use Nuxt for the rest. The advantage of Nuxt is that I can decide between SPA, server-side or static generation. That allows me to make a full web application that uses the best of all 3 methods in parallel e.g. shows static-generated pages for public pages but makes the switch to server-side rendering when e.g. user logs in and needs data that only belongs to the user. SPA is almost never an option for me. Does Gridsome also work with server-side rendering of Vue.js? Also something that turns me off a bit is that the documentation contains many empty pages. In my humble opinion, I would only put stuff in there that is already implemented and only release features when it's documented. Because that's one of the biggest strengths Vue.js and Nuxt.js come with: A very strong documentation. But I know that my concerns are probably not valid as long as it doesn't reach v1.0.0. |
We're a strong believer in JAMstack. That means generating as much as possible up front (at build time) and then add dynamic stuff by fetching data on the client side. So I think Gridsome can be used for most things if you go this route. For example, user data could just be fetched on the client side if the user was authenticated. This makes it possible to host your app on a CDN and you don't need a Node.js server. Here is how Gatsby does it (React alternative) https://www.gatsbyjs.org/blog/2018-11-07-gatsby-for-apps/
Gridsome is server-side rendered at built time.
Thanks for the feedback! This is there so people could contribute if they want. If not we'll try to add them before 1.0 is released. |
As @tomtev wrote, all pages are server-side rendered by Vue.js at build time. But Gridsome also has a built-in |
I don't think that is what server-side rendering means. In my understanding that's just static-generation. Server-side rendering is what @hjvedvik means with the dev server.
Yes, that's nice and that's what I do for many cases, but I'll never ever just use SPA for things like user areas. A server-side or static-generated fallback is always required in my cases to ensure client-side error fallbacks, usability and accessibility workarounds. I think I now understood that this is completely targeted in direction of the JAMStack. Still, I think your work with the data adapters is awesome and if I would have the possibility to use them outside of Gridsome for all those cases where I can't leverage the JAMStack thus need server-side rendering too, that would be a dream. But I understand that this is miles out of scope. |
If we can’t agree that server-rendered at build time and static generation are the same thing, we need to just pack it all in and become sheep herders. |
So then let me correct and say I just never heard it in that context and find it misleading as I clearly talk about server-side rendering as a fallback for SPA in the example context of user logins. |
SSR and static rendering are related, but not the same. Static rendering generates a page once and then serves that same page to everyone who requests it. The content of the page is considered static and cacheable. SSR typically renders the page on every request to the server, and typically has a low cache ttl (or never cacheable). |
We talk about "Server-side rendering at build time" because that is exacly what's happening. The pages are rendered at the server, not the client. They are pre-rendered at build time instead of when a user is requesting it. This results in better speed and no need for caching etc. |
That is it... A better term would be pre-rendered at build time.
No need for caching? Caching helps definitely with static html sites, especially large ones (i.e. either local cached copies on the user's browser, or cached on an intermediate cache, such as CloudFlare etc). |
Jah wouldn't now start mixing in any caching topics. It's also good practice to cache HTML and actually when you use a CDN e.g. Netlify, that will pretty sure cache things on a cache proxy server (as it's actually the point of the CDN to be fast). Pre-rendered is exactly the right term here. Anyway, I didn't want to open Pandora's box about a SSR discussion. I got my answers and will keep Gridsome on the radar for production when it hits 1.0.0. Keep on going with the great work. Looking forward to that animation/page transition support. |
“Why did you stop developing Gridsome?” “People kept arguing the semantics of ‘server-rendered’.” |
a pretty good recent article on the topic
https://developers.google.com/web/updates/2019/02/rendering-on-the-web |
If you have a large blog, will Gridsome prefetch hundreds of pages of content? Isn't that pretty heavy, especially for mobile users? We are building a new blog with Nuxt pulled data from Airtable. Right now it's just a prototype, and I'm interested in switching to Gridsome because I've done several sites in the past with Gatsby and have a high opinion of it. But 1) Gridsome development seems to be going pretty slow, so it looks like we might not see v1 in the near future, and 2) we may have hundreds or thousands of posts over time, so I'm not sure if the prefetching will be a problem will actually hurt Google's site performance ratings. With VuePress we found we actually scored higher on performance if we disabled prefetching. Finally, if there a way to build an "infinite scroll" experience Gridsome? For our main page, we'd like to have a chronological list of all our articles, newest first. With a SPA model I'd just load the first 10 and them implement a scroll trigger to pull more content from the API. With a static site, should I just pretty much just load all the content in one huge page, or is there a more sophisticated strategy? @hjvedvik @tomtev Cheers! |
@brandonpittman I know Gatsby is using "Server-side rendering at build time" in their presentations.
It only prefetches links that are in view. So it's perfect for mobile users.
We will release 0.5 today. It is a huge version with many important features and changes under the hood. We're actually not that far from 1.0 :)
We will have a built-in feature for this in the future. Just like our Pagination support. For now you need to load all posts with GraphQL and just manually split the post array.
We might start a Patreon or Open Collective very soon. |
We'll close this now :) Here is a great podcast about Next VS Gatsby: Next is the react alternative for Nuxt Nuxt do some stuff better and simpler than Next tho :) |
Hello. @hjvedvik |
Hi @petar7777. That issues has already been reported here, with suggestions for fixes: #252 |
Hi @robaxelsen |
Indeed that's how it's typically done, Nuxt does allow to fetch all your data at once before compile time, and pass the data to the pages. ie, you could fetch all users from an api in the config's Both frameworks are great though. |
@Maxhodges we also use Airtable as our backend, though for much more than just Blog posts. We organize weddings all over Europe, so we have 100s of venues and "projects" (past weddings) we showcase on our website, plus all you typical pages like /contact, /faq etc., as well as blog posts. I plan to use something like Nuxt or Gridsome to pre-render 99% of the content, of which the bulk will come from Airtable records (+Cloudinary for images ...we have 1000s of them) and a few really static ones (homepage, /contact etc.) from YAML files, which my content guys will edit directly on GitHub first and later with something like Forestry (if needed). Later we might add few SPAs for things like "MyWedding" page where our clients will manage / track progress of their wedding being planned etc. Gridsome makes really good impression and I like the idea of "source plugins" (though the Airtable plugin is no good for us, because it only gets data from single Airtable table), though after doing huge corporate ERP projects for 10 years, I always also keep other things in mind such as maturity, stability, docu, availability of freelance talent, paid support from the creators with SLA, potential longevity etc., so as of now I'm also debating Gridsome vs. Nuxt. Having said that, it will be another 2-6 months until we actually will start implementing this project, so I'll keep an eye on Gridsome until then! Are you on Discord?
...and...
I'm not 100% sure, isn't this how you do it in Nuxt? So in other words:
...equals Nuxt:
? Note I am noob in the whole headless, JAMstack, SPA, ...and even JS world, so I might be totally confusing things here, only judging from reading the docus. |
@peachp Nuxt isn't fully static and in my understanding, follows the way how Gatsby (correct me if I'm wrong) does it: Generate static pages for first load, but allow client-side async loading for navigation (as soon as you navigate after first load). Nuxt allows you to do stuff like page transitions or transitions for loading and including async data. But it also requires more traffic from your API as, in addition to the build that makes API requests on every change, every user also makes API requests on the running application. This can especially be a drawback if you use something like Dato CMS or Contentful, when you have API request limits. Gridsome is fully static and thus doesn't come with the overhead of client-side async requests. This can especially be useful if you want to hide the API you are using and want to save requests. Most of the static-site generators work the way Gridsome works. A fully static generated mode for Nuxt is also in the works. |
@renestalder The way you describe it, it sounds like this Nuxt's However, when I read further, it says something about payload and generate.interval, which indicates that some data (payload) is indeed pre-fetched / pre-rendered at generate / build time, and not jsut at run-time? Speeding up dynamic route generation with payload Not sure if I interpret it correctly. |
I'm the OP, but after our team built sites with Nuxt, Gridsome, VuePress, we prefer both Gridsome and VuePress over Nuxt. I'll see if our CTO @frandiox would like to chime in We prefer Gridsome once it has i18n |
Thank everyone, quite helpful content, easy to get a big picture for someone who wants to choose either of one for their application. :) |
It seems Gridsome dev has really slowed. Is funding an issue? Did you setup a Patreon? |
@Maxhodges Money is not a problem. It's the time. We're still working a lot on Gridsome and planning how 1.0 will be. There is also a lot of work and planning happening outside of the repository. Like for example how to make sure v1.0 will be 100% ready for Vue 3.0.
|
thanks, I tried reaching out to you guys off-repo... is there anything I can do to help accelerate development? Maybe start an official Paetron for Gridsome and use it to incentivize other contributors (if money isn't an issue for you two core devs)? |
It is very sad to see that the only Vue alternative for GatsbyJS is having such a slow progress. Not to be rude or so, in fact I am very happy to see what product it is evolving into however I believe it also misses out a lot on potential users due its lack of development. VueJS 3.0 is a big thing and I waiting for it as well. Especially for native TypeScript support but it shouldn't be a major slowdown as it will not introduce any major breaking changes. :) By writing, I simply express my concern and interest in Gridsome. And of course, I would happy to become Patreon if that would help! |
a developer tells me gridsome can't do anything that NUXT can't do regarding static site generation. Should I believe him?
The text was updated successfully, but these errors were encountered: