Weave includes built-in support for Progressive Web Apps (PWAs), allowing your applications to be installed on devices and provide a more app-like experience.
Weave automatically generates and serves the necessary resources for PWAs:
Note: Currently, Weave does not automatically generate a service worker, which is required for full PWA functionality like offline support. If you need offline capabilities, you'll need to implement a custom service worker and register it in your application.
To enable PWA features in your Weave application, provide an :icon
path and optional :pwa configuration when starting your application:
(weave/run view-fn
{:title "My PWA App"
:icon "public/my-icon.png" ;; Path to an icon in your classpath
:pwa {:name "My PWA App"
:short-name "MyApp"
:description "A description of my application"
:display "standalone"
:background-color "#f2f2f2"
:theme-color "#4a86e8"
:start-url "/"}})
The icon you provide should be:
Weave will automatically resize your icon to create:
/favicon.png (32x32) - For browser tabs/icon-180.png (180x180) - For iOS home screens/icon-192.png (192x192) - For Android home screens/icon-512.png (512x512) - For high-resolution displaysThe :pwa configuration map supports these options:
| Option | Description | Default |
|---|---|---|
:name | Full application name | Value of :title option |
:short-name | Short name for app icons | Same as :name |
:description | App description | None |
:display | Display mode | "standalone" |
:background-color | Background color during loading | "#f2f2f2" |
:theme-color | Theme color for browser UI | "#ffffff" |
:start-url | URL to load when app launches | "/" |
Modern browsers provide tools to test PWA functionality:
When users visit your Weave application in a supported browser:
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |