junohamburg/kirby-reload-on-save 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

junohamburg/kirby-reload-on-save

Composer 安装命令:

composer require junohamburg/kirby-reload-on-save

包简介

Kirby Reload On Save

README 文档

README

This plugin for Kirby 3, 4 and 5 automatically reloads the frontend when content changes are saved in the panel.

It uses the Broadcast Channel API to communicate between panel and frontend. There is no build tool or npm install necessary, so the plugin can be used both in your local development and your production environment.

preview.mp4

Clicking "Save" or using CMD+S / CTRL+S saves the content and reloads the frontend.

Installation

Download

Download and copy this repository to /site/plugins/kirby-reload-on-save.

Composer

composer require junohamburg/kirby-reload-on-save

Git submodule

git submodule add https://github.com/junohamburg/kirby-reload-on-save.git site/plugins/kirby-reload-on-save

Setup

Enable the plugin in your config using in the ready option shown below. That way, the plugin is only active when the user is logged in and it does not interfere with the Kirby cache.

site/config/config.php

<?php

return [
  'ready' => function ($kirby) {
    return [
      'junohamburg.reload-on-save' => [
        'active' => $kirby->user() !== null
      ]
    ];
  }
];

Tip: If you only want to enable the plugin in your local development environment, use domain/environment specific config files: Kirby docs

How it works

The plugin uses the Broadcast Channel API to communicate between tabs: One Broadcast Channel is added in the panel, another one is added in the frontend using a page.render:after hook. When the user saves content changes in the panel, the Broadcast Channel in the panel sends a message to the frontend to reload the page.

Limitations

  1. This plugin will reload any open page in your frontend. There is no distinction which page (or file or user) was saved in the panel – only if the page belongs to the same site.
  2. Uploading files, adding new pages, changing the page title or other actions that do not trigger a content/save action in the panel will not reload the frontend automatically.
  3. The Broadcast Channel API is supported by any modern browser, except Safari 15.3 and older: Can I Use

License

MIT

Credits

统计信息

  • 总下载量: 3.64k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 29
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 29
  • Watchers: 1
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固