react-static README

The project's README from github.com/react-static/react-static. As one markdown file: README.md.

This is now in maintenance only mode. No new major versions will be released.

Remix and NextJS are good alternatives.

Where is react-static 8? The state of react-static -- and its inevitable death. #1661


React Static Logo

Travis CI Build Status npm package v npm package dm Github Stars Twitter Follow



You are viewing the docs for v7 of React Static. You can browse all historical versions via Github branches!

React Static

A progressive static-site generator for React.

React-Static is a fast, lightweight, and powerful progressive static site generator based on React and its ecosystem. It resembles the simplicity and developer experience you're used to in tools like Create React App and has been carefully designed for performance, flexibility, and user/developer experience.

Features

Sites Built with React-Static

See a list of sites

Quick Start

$ npm i -g react-static
# or
$ yarn global add react-static
$ react-static create
$ react-static --help

Documentation

Migration from a previous version?

The CHANGELOG contains information on breaking change for each major version. The latest breaking changes along with their migration tips are located here

What is a progressive static site?

A progressive static site is a website where every statically exported HTML page is an entry point to a fully-featured automatically-code-split React application. Just like a normal static site, static progressive websites are capable of loading initial landing pages very quickly, but then extend the user experience by transforming invisibly into a single-page React application.

Once a progressive static site page has loaded its React application it can then do amazing things!

How does it work?

Flow Chart

React Static gathers your data, and templates together and intelligently splits them into bite-size static files using webpack and javascript. Once these files have been generated, React Static uses them to render and export a list of routes that you provide it into HTML files! After your site has been exported, the resulting data, template, and html files can be transfered to a static file server and browsed as an awesomely fast and performant static website!

But remember, a progressive static site is more than that...

Little did you know that when React Static exported your site, it also generated a tiny, optimized, and code-split version of your original React application for every page of your site! After these pages have loaded, React invisibly mounts this application to the existing HTML on the page and... 🎉🎉🎉 You are now using the single page React application you originally built! This application is special, though! While you browse your website, pages that you might go to next are automatically preloaded, making navigation to them instantaneous!.

That's just the beginning! With React Static, you can unleash your creativity and build anything you can imagine with speed and productivity. It even has awesome plugins that will help you on your journey!

Coming from Create React App?

React Static is also a great replacement for the ever popular Create React App CLI. It provides a similar developer experience, zero-config environment, and features, but without boxing you in. If you ever need to customize your build system in React Static, there is no need to eject! You can use existing plugins or write your own to customize anything you'd like about the build system. Not building a static site? No worries there, React Static works as an SPA too, even if there is only a single index.html file.

Articles, Videos & Tutorials

Support, Community & Chat

Need some help? Have a quick question? Click here to go to GitHub Discussions! We are constantly answering questions, discussing features and helping each other out!

Contributing, Issues & Bugs

We are always looking for people to help us grow react-static's capabilities and examples. If you have found a bug, or have a feature request let us know! Please follow CONTRIBUTING.md if you want to help out.

License

React Static uses the MIT license. For more information on this license, click here.

react-static (react-static/react-static)

Searching Database…

这是做什么的?React Static 是一个面向 React 的渐进式静态网站生成器:它把你的网站导出为加载迅速的静态 HTML 页面,而每个页面又能启动一个完整的 React 单页应用。
用它搭出来的网站为什么说是“渐进式”,而不只是静态的?每个导出的 HTML 页面都是一个自动按需拆分代码的 React 应用的入口:页面先以静态 HTML 的形式瞬间加载,然后变成一个单页应用(SPA),可以预取其他页面、瞬时切换页面,还能渲染实时数据。
我怎么用它搭一个网站?安装 React Static CLI 工具,用它来创建一个新项目;文档接着会讲解核心概念、配置、API 和插件。
这个项目还在积极开发吗?没有了。它现在只做维护,不会再发布新的大版本,README 里也直接推荐 Remix 和 Next.js 作为替代方案。
我一直在用 Create React App,这个和它像吗?像——它延续了 CRA 那种零配置的开发体验,但不会把你困住:不用 eject 弹出配置,而是用现成的或自定义的插件来定制构建;它甚至可以只带一个 index.html,当作普通单页应用来用。
它的构建在底层是怎么运作的?React Static 会收集你的数据和模板,用 webpack 把它们拆成一个个小的静态文件,再把你定义的路由渲染成 HTML 文件,最终结果可以部署到任何静态文件服务器上。
开发的时候支持热更新吗?支持,开箱即用——修改 React 组件、样式甚至数据,网站都会实时更新。
有人在生产环境用它吗?有——README 里列出了星巴克的 Careers Hub 和 Rewards 页面、HeadlessCMS.org、Intuit Turbo、Stoplight,以及许多个人和公司网站都是用 React Static 搭建的。
Size
36.9 MB
Stars
10.3K
Age
9y
Commits · 90 Days