定制 cecil/theme-pwa 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

cecil/theme-pwa

最新稳定版本:2.20.0

Composer 安装命令:

composer require cecil/theme-pwa

包简介

Cecil component theme PWA

README 文档

README

The PWA component theme for Cecil provides helpers to implement a Web manifest and a service worker to turn a website into a Progressive Web App.

Features

  • Generated and configurable Web manifest
  • Generated and configurable service worker
  • Automatic caching of visited resources
  • No dependencies, vanilla JavaScript
  • Precaching of assets and published pages
  • Offline support and image placeholder
  • Custom install button support instead of browser prompt

Prerequisites

Installation

composer require cecil/theme-pwa

Or download the latest archive and uncompress its content in themes/pwa.

Usage

Add pwa in the theme section of the config.yml:

theme: - pwa

Add the following line in the HTML <header> of the main template:

{{ include('partials/pwa.html.twig', {site}, with_context = false) }}

Web manifest

Configure web manifest options:

manifest: background_color: '#FFFFFF' theme_color: '#202020' icons: - icon-192x192.png - icon-512x512.png - src: icon-192x192-maskable.png purpose: maskable - src: icon-512x512-maskable.png purpose: maskable

Note

You can specify a dark theme color with theme_color_dark option.
The icons section is optional. If not provided, the theme will generate a default set of icons based on the icon.png file in the assets directory of your website.

Tip

Create your own maskable icons with Maskable.app.

Web manifest Optional

Add shortcuts from the main menu entries:

manifest: shortcuts: true

Provide installer screenshots:

manifest: screenshots: - screenshots/desktop.png - screenshots/mobile.png

Service worker

Enable the service worker:

serviceworker: enabled: true

Service worker Optional

Disable browser install prompt, and use custom install button:

serviceworker: install: prompt: false button: '#install-button' # query selector
<button id="install-button" hidden>Install App</button>

Icons are precached by default. To disable this behavior:

serviceworker: install: precache: icons: false

By default all published pages are precached. To limit this number:

serviceworker: install: precache: pages: limit: 10

Set list of precached assets:

serviceworker: install: precache: assets: - logo.png

Display a snackbar on update and connection lost:

serviceworker: update: snackbar: true offline: snackbar: true

Define ignored paths:

serviceworker: ignore: - name: 'cms' path: '/admin'

Do not precache a specific page (through its front matter):

--- serviceworker: precache: false ---

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Twig

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固