Bundle Installation
To install the bundle, the recommended way is using Composer:
composer require spomky-labs/pwa-bundleNo Flex recipe exists for this bundle, but you can create a configuration file that will be modified as you progress in the integration of the features.
pwa: ~The integration in your application is very simple. You are only required to add a Twig function inside the end of the <head> tag of your HTML pages.
<!DOCTYPE html>
<html lang="en">
<head>
{{ pwa() }}
</head>
<body>
...
</body>
</html>Twig Function Options
The pwa() Twig function accepts several optional parameters to control what is injected:
{{ pwa(
injectThemeColor: true,
injectFavicons: true,
injectSW: true,
swAttributes: {},
locale: null,
injectResourceHints: true,
injectSpeculationRules: true
) }}injectThemeColor
bool
true
Inject theme color meta tags
injectFavicons
bool
true
Inject favicon link tags
injectSW
bool
true
Inject service worker registration script
swAttributes
object
{}
Custom attributes for the service worker script tag
locale
string
null
Locale for manifest (auto-detected from request if null)
Example: Disable Resource Hints
Example: Localized Manifest
Last updated
Was this helpful?