pantheon-systems/decoupled-preview
Composer 安装命令:
composer require pantheon-systems/decoupled-preview
包简介
Preview WordPress content on Front-end sites including Next.js
README 文档
README
Preview headless WordPress content on your front-end site.
This plugin intends to provide a single home for preview on a variety of decoupled front-ends.
Features
- Preview while editing a Post/Page.
- Configure multiple preview sites.
- Specify the post types (Post and Pages) that each preview site applies to.
Configuration
In the WordPress Admin Dashboard, navigate to Settings -> Preview Sites (/wp-admin/options-general.php?page=preview_sites), add
one or more preview sites, and configure the following:
- Label: The name of the site.
- URL: The URL of the decoupled site you are providing preview data to.
- Secret: A token that will be passed to your decoupled site used to limit access to the preview.
- Preview Type: The type of preview site - currently only NextJS is supported.
- Content Types: The post types (like Post and Page) that this preview site applies to.
Preview Types
While we hope to expand in the future, the initial release of this plugin only supports NextJS. It was developed in support of Pantheon's Next WordPress Starter, but can be applied to other NextJS sites using a similar approach.
Known Issues
- Currently this plugin does not support custom post types.
- Currently this plugin does not support the classic editor.
Linting and Testing
This plugin uses Composer to manage dependencies. To install dependencies, run composer install from the plugin directory.
Linting is done with PHP_CodeSniffer using the Pantheon WP Coding Standards ruleset. To run the linting checks, use the following command:
composer lint
Unit tests are written with PHPUnit using the WP Unit test framework. To set up your local maching to be able to run the unit tests, use the following command:
composer test:install
Note that you will need to have MariaDB or MySQL installed and running on your local machine. Once you have the test environment set up, you can run the unit tests with the following command:
composer test
Both linting and testing are done in a GitHub Action on every commit and pull request. Tests are located in the tests directory.
pantheon-systems/decoupled-preview 适用场景与选型建议
pantheon-systems/decoupled-preview 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.55k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2022 年 12 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pantheon-systems/decoupled-preview 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pantheon-systems/decoupled-preview 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.55k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2022-12-14