Static website generator? Why don't I use it? Kev Quirk's short comment: Kev uses WordPress:
Want to blog on your iPad? no problem. Want to write on your phone? That's OK. Written on machines that I don't use often? As long as you have a browser, there is no problem.
First of all, it is worth mentioning that using WordPress does not mean that you cannot use static website generators. WordPress has an API that makes it possible to call the API during the build process to build your website. That's what Gatsby does, it has a plugin that exports static websites, while projects like Frontity blur the lines.
But I agree with Kev's reason. For all his reasons, and countless others, running a WordPress website is a perfectly acceptable and often wise choice. I think it's about robustness and functional completeness. Need e-commerce capabilities? WordPress has it. Need a form? There are many excellent plugins. Need to enhance the functionality of CMS? You can control the content type and its content. Need authentication? This is the core function. Want an excellent editing experience? Gutenberg is awesome.
Time and again, I quickly and efficiently build what I want with WordPress, which makes me feel efficient and powerful. But I don't want to talk about WordPress in particular; the same applies to any "classic" CMS. Craft CMS has a GraphQL API natively. We just posted a post about the Drupal Jamstack webinar.
In a relatively new world of static websites, a small thing can end up turning into a long process of research and implementation, and it feels like you are the only person on earth doing it.
Having said that...
What do I think of the static website generator and the world of Jamstack? They are great .
I think there are many benefits to building a website this way. The separation of data and front-end is wise. Very safe. The developer experience is also great, and everything is great for deploying previews and Git-based. The startup speed is amazing (providing HTML services from CDN is a feat).
Just like a classic server-side CMS won't stop you from building static websites, using static websites won't stop you from doing dynamic things — even super advanced dynamic things. Josh Comeau has a great new article that goes into this in depth. He built a nifty little app that does a lot of work with React in his browser, but that doesn't mean he still can't serve most of the content statically. He calls it a "change in mindset" and refers to what you might think you need a database call, but do you really need it? Has the database call occurred and a static file been generated? If not, then part of the content can still be generated statically and the rest can be obtained dynamically.
I look forward to a world where we begin to truly see the best of both worlds. We generate as much content as possible, get as much content as we can through the API that we cannot generate statically, and do not sacrifice the best tools throughout the process.
When to choose a static website...
- If you can, you should consider it because it is unparalleled in speed and safety.
- If you are working on a Greenfield project.
- If your project is built from and uses an accessible API, you can call the API during the build process and use it after the initial HTML is loaded.
- If a static website generator looks great for what you are doing.
- If the cost analysis shows it is cheaper.
- If certain features (such as build previews) are very helpful for the workflow.
When to choose server-side software...
- If you need the functionality of a classic CMS (such as WordPress), and the technical debt from there is too high.
- If you have been deeply involved in a server-side rendering project (Ruby on Rails, Python, etc.) and have not encountered any existing problems.
- If your team has the most expertise in the field.
- If the cost analysis shows it is cheaper.
- If there is no good static solution for what you want to build (such as forum software).
- If you are in extreme situations, such as millions of URLs, and the static build time is too long.
The wrong reason to choose a static website...
- You need to use a server. (Why? You can still call the API on the server at build time or runtime.)
- You need authentication. (Why? Jamstack can perfectly implement authentication with JWT, etc.)
- You haven't even considered the Jamstack approach.
The error reason for choosing server-side software...
- You haven't even considered the Jamstack approach.
- Because you think using comfortable/existing/classic/mature/supported well-supported tools will prevent you from building anything statically.
- Questions like SEO. (If anything, static rendering should perform better. However, it is understandable if the shift to static means turning to client calls to get product data, etc.)
The above is the detailed content of Static or Not?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

CSS blocks page rendering because browsers view inline and external CSS as key resources by default, especially with imported stylesheets, header large amounts of inline CSS, and unoptimized media query styles. 1. Extract critical CSS and embed it into HTML; 2. Delay loading non-critical CSS through JavaScript; 3. Use media attributes to optimize loading such as print styles; 4. Compress and merge CSS to reduce requests. It is recommended to use tools to extract key CSS, combine rel="preload" asynchronous loading, and use media delayed loading reasonably to avoid excessive splitting and complex script control.

ThebestapproachforCSSdependsontheproject'sspecificneeds.Forlargerprojects,externalCSSisbetterduetomaintainabilityandreusability;forsmallerprojectsorsingle-pageapplications,internalCSSmightbemoresuitable.It'scrucialtobalanceprojectsize,performanceneed

No,CSSdoesnothavetobeinlowercase.However,usinglowercaseisrecommendedfor:1)Consistencyandreadability,2)Avoidingerrorsinrelatedtechnologies,3)Potentialperformancebenefits,and4)Improvedcollaborationwithinteams.

CSSismostlycase-insensitive,butURLsandfontfamilynamesarecase-sensitive.1)Propertiesandvalueslikecolor:red;arenotcase-sensitive.2)URLsmustmatchtheserver'scase,e.g.,/images/Logo.png.3)Fontfamilynameslike'OpenSans'mustbeexact.

Autoprefixer is a tool that automatically adds vendor prefixes to CSS attributes based on the target browser scope. 1. It solves the problem of manually maintaining prefixes with errors; 2. Work through the PostCSS plug-in form, parse CSS, analyze attributes that need to be prefixed, and generate code according to configuration; 3. The usage steps include installing plug-ins, setting browserslist, and enabling them in the build process; 4. Notes include not manually adding prefixes, keeping configuration updates, prefixes not all attributes, and it is recommended to use them with the preprocessor.

CSScounterscanautomaticallynumbersectionsandlists.1)Usecounter-resettoinitialize,counter-incrementtoincrease,andcounter()orcounters()todisplayvalues.2)CombinewithJavaScriptfordynamiccontenttoensureaccurateupdates.

In CSS, selector and attribute names are case-sensitive, while values, named colors, URLs, and custom attributes are case-sensitive. 1. The selector and attribute names are case-insensitive, such as background-color and background-Color are the same. 2. The hexadecimal color in the value is case-sensitive, but the named color is case-sensitive, such as red and Red is invalid. 3. URLs are case sensitive and may cause file loading problems. 4. Custom properties (variables) are case sensitive, and you need to pay attention to the consistency of case when using them.

CSSselectorsandpropertynamesarecase-insensitive,whilevaluescanbecase-sensitivedependingoncontext.1)Selectorslike'div'and'DIV'areequivalent.2)Propertiessuchas'background-color'and'BACKGROUND-COLOR'aretreatedthesame.3)Valueslikecolornamesarecase-insens
