内容和静态站点
随着服务器端框架和内容管理系统的出现,构建以电子表格为真实来源的网站成为可能!该演示探索了多种方法。
¥With the advent of server-side frameworks and content management systems, it is possible to build sites whose source of truth is a spreadsheet! This demo explores a number of approaches.
流程
¥Flow
网站生成器的核心是提供用于提供内容和模板的结构。在发布步骤期间,生成器将分析内容并通过将模板应用于内容来生成网页。它在精神上与 "邮件合并" 相似。
¥At its core, the site generators provide a structure for supplying content and templates. During a publish step, the generators will analyze the content and generate web pages by applying the template to the content. It is spiritually similar to "Mail Merge".
这种内容和演示的分离使分析师和其他电子表格用户可以轻松地使用他们的数据生成文件并快速更新网站!
¥This separation of content and presentation makes it easy for analysts and other spreadsheet users to generate files with their data and quickly update websites!
实时重新加载
¥Live Reload
许多框架提供了监视文件更改的开发流程。当使用电子表格作为数据源时,内容创建者可以在对电子表格进行更改时在预览环境中看到更新!
¥Many frameworks offer a development flow which watches files for changes. When using a spreadsheet as the data source, this allows the content creators to see updates in a preview environment as they make changes to the spreadsheet!
以下 GIF 动画显示了开发模式下的静态站点生成器。用户正在使用 Numbers 编辑电子表格。每次保存页面时,浏览器都会刷新以显示新内容。
¥The following GIF animation shows a static site generator in development mode. The user is editing a spreadsheet with Numbers. Every time the page is saved, the browser refreshes to show the new content.
生态系统
¥Ecosystem
强烈建议使用无遥测的框架,该框架提供了用于使用 SheetJS 的官方插件。
¥It is strongly recommended to use a telemetry-free framework that provides an official plugin for working with SheetJS.
Lume 是轻量级网站的绝佳选择。
¥Lume is a great choice for lightweight sites.
官方的
¥Official
一些框架提供官方扩展。强烈建议将它们用于新建项目。
¥Some frameworks provide official extensions. They are strongly recommended for greenfield projects.
打包器
¥Bundlers
打包器可以在开发和站点构建期间运行 JS 代码并处理资源。自定义插件可以从电子表格中提取数据。
¥Bundlers can run JS code and process assets during development and during site builds. Custom plugins can extract data from spreadsheets.
解决方法
¥Workarounds
其他站点生成器需要针对各种限制和假设的解决方法:
¥Other site generators require workarounds for various limitations and assumptions: