TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Are GatsbyJS / Next.js “worth it?”

4 点作者 saurabhnanda将近 5 年前
I know this is a highly subjective, and possibly loaded, question. But here are the related questions at the back of my mind when I ask this:<p>- Do I really need to use React (a client-side framework) to generate static websites? What&#x27;s wrong with Ruby + Liquid (that I&#x27;m familiar with), or anything similar (Python, PHP, etc)?<p>- Assuming that the static website doesn&#x27;t include a lot of JS in the first place, exactly how much faster is the Lighthouse&#x2F;PageSpeed score for static websites built with Gatsby&#x2F;Next JS? Are there any benchmarks available? Do these frameworks optimize the CSS delivery as well (remove unused CSS, inline the CSS, etc)?<p>- What are the chances that the JS community will jump to the &quot;next new thing&quot; in 2 years and I&#x27;ll be stuck with a pile of unmaintained mess?<p>- Are there frameworks for Ruby&#x2F;Rails that do a similar job? Does Jekyll (or Hugo) come close?<p>- Are Gatsby &#x2F; Next JS really for static website, or for mostly static websites with a sprinkling of dynamic elements (eg. e-commerce, travel booking, etc), that people unnecessarily wrote in React, and ended-up creating a problem where none existed?<p>- What is truly the sweet spot for this kind of technology? Google search results are full of blog posts where people are just discovering these frameworks (or by companies who are pushing them).

2 条评论

chinchang将近 5 年前
You want a static one or two page site -&gt; Use simple HTML pages<p>You want to have some templating and data integration -&gt; Use Eleventy (<a href="https:&#x2F;&#x2F;11ty.dev" rel="nofollow">https:&#x2F;&#x2F;11ty.dev</a>)<p>You want to have a complete framework -&gt; Use Next.js :)<p>Note: Beyond Next.js you won&#x27;t need anything else for any kind of website :)
deltron3030将近 5 年前
&gt; Do I really need to use React (a client-side framework) to generate static websites? What&#x27;s wrong with Ruby + Liquid (that I&#x27;m familiar with), or anything similar (Python, PHP, etc)?<p>I think it depends on the other tools you&#x27;re using in your tech stack. React is a popular choice for highly interactive webapps, so the people who are into building apps with React benefit from not having to switch between vastly different toolchains for their blogs and marketing sites. Rails or Laravel users who use templating might do the same, pick a site generator that&#x27;s close to their main way of working.<p>&gt; Assuming that the static website doesn&#x27;t include a lot of JS in the first place, exactly how much faster is the Lighthouse&#x2F;PageSpeed score for static websites built with Gatsby&#x2F;Next JS? Are there any benchmarks available? Do these frameworks optimize the CSS delivery as well (remove unused CSS, inline the CSS, etc)?<p>Speed depends mostly on how you bundle and load the assets for your site, fonts, images, external JS marketing widgets and stuff like that. Gatsby comes with tools to optimize those things, and when people say that Gatsby or Next are fast it&#x27;s mostly because of the way you link to your sites internally. They have a custom &lt;Link&gt; component able to fetch pages in the background, so as soon as users hover over links it&#x27;s already loaded when they&#x27;re clicking. That&#x27;s happening so fast that you often don&#x27;t realize that something has changed. Personally, from a user perspective it&#x27;s not something that I need to have, I expect pages to load or a transition.<p>&gt; - What are the chances that the JS community will jump to the &quot;next new thing&quot; in 2 years and I&#x27;ll be stuck with a pile of unmaintained mess?<p>It&#x27;s likely that your page will be outdated once React itself advances and the ecosystems jumps on a new way of doing things. You have to be part of the ecosystem and &quot;go with the times&quot;. This ties back to my first answer, most users of JS based generators are part of the ecosystem and even enjoy rewriting their stuff with newer tools, it&#x27;s part of their work and also hobby.<p>&gt; - Are there frameworks for Ruby&#x2F;Rails that do a similar job? Does Jekyll (or Hugo) come close?<p>Jekyll is a sane long term choice, it&#x27;s battle tested, has a nice ecosystem and won&#x27;t likely change that much in the future. It&#x27;s only that builds are slow, so for larger sites with thousands of pages and frequent content updates maybe not the best choice if you can&#x27;t wait hours for it to build.<p>No idea about Hugo, but an alternative to Jekyll with much faster build times is Eleventy, but it&#x27;s also young and likely going to change, and it&#x27;s ecosystem isn&#x27;t that mature. If you&#x27;re chosing Rails for stability reasons then you can&#x27;t really go wrong with Jekyll, it fits well into that strategy.