https://github.com/ragingwind/pwa-manifest
Create a Web Manifest for Progressive Manifest with a variety of options
https://github.com/ragingwind/pwa-manifest
Last synced: 11 months ago
JSON representation
Create a Web Manifest for Progressive Manifest with a variety of options
- Host: GitHub
- URL: https://github.com/ragingwind/pwa-manifest
- Owner: ragingwind
- License: mit
- Created: 2016-04-01T02:15:20.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-02-13T20:02:04.000Z (over 4 years ago)
- Last Synced: 2025-07-23T05:48:45.287Z (12 months ago)
- Language: JavaScript
- Size: 991 KB
- Stars: 12
- Watchers: 2
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# pwa-manifest [](https://travis-ci.org/ragingwind/pwa-manifest)
> Creating a Web Manifest for Progressive Web App with a variety of options
## Install
```
$ npm install --save @pwa/manifest
```
## Usage
```js
const pwaManifest = require('@pwa/manifest');
(async () => {
const manifest = await pwaManifest({
name: 'My PWApp',
short_name: 'My Short PWA Name',
start_url: '/index.html?homescreen=1',
display: 'standalone',
background_color: '#EFEFEF',
theme_color: '#FFEEFF'
})
// dump new generated manifest file if you want
await pwaManifest.write('./', manifest);
})();
```
or we support decamelizing from camelized properties
```js
(async () => {
const manifest = await pwaManifest({
name: 'My PWApp',
shortName: 'My Short PWA Name',
startUrl: '/index.html?homescreen=1',
display: 'standalone',
backgroundColor: '#EFEFEF',
themeColor: '#FFEEFF'
});
})();
```
## API
### pwaManifest([options])
#### options
Type: `object`
Web Manifest properties you want to set. The name of options are same as member property of Web Manifest. Icons sizes are followed in [lighthouse audits](https://github.com/GoogleChrome/lighthouse/tree/9f91ab405ca89882f40a71c6aef5dc6dc08543b4/lighthouse-core/audits)
```
{
"name": "My Powerful Progressive Web App",
"short_name": "PWApp",
"icons": [{
"src": "icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
}, {
"src": "icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
}, {
"src": "icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}],
"start_url": "/index.html?homescreen=1",
"display": "standalone",
"background_color": "#FFFFFF",
"theme_color": "#3F51B5"
}
```
### pwaManifest.write(dir, manifest)
Returns a promise.
### pwaManifest.writeSync(dir, manifest)
Write a manifest file as `manifest.json` to dest path.
### pwaManifest.read(dir)
Returns a promise.
### pwaManifest.readSync(dir)
Read a manifest file in the name of `manifest.json` to src path
## License
MIT © [Jimmy Moon](http://ragingwind.me)