2.3.17 • Published 3 years ago

manifest-creator-webpack-plugin v2.3.17

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Manifest Creator Webpack Plugin

1000+ Downloads/Week Version Node Versions Webpack Versions HTML Webpack Plugin Versions License

manifest-creator-webpack-plugin is a webpack plugin for creating progressive web app manifest files. It exports a manifest file to the build directory.

Features

  • Export icons defined in the manifest file
  • Automatically add type for icons
  • Minify the manifest file
  • Inject manifest link to pages generated with html-webpack-plugin

Installation

Install manifest-creator-webpack-plugin as a dev dependency:

npm install --save-dev manifest-creator-webpack-plugin

You will also need to have webpack installed:

npm install --save-dev webpack

To use the full feature set of the plugin, also install html-webpack-plugin:

npm install --save-dev html-webpack-plugin

Usage

In your Webpack configuration file, import manifest-creator-webpack-plugin. Add it to your plugins array (if used with html-webpack-plugin, html-webpack-plugin must come first in the array):

webpack.config.js

const ManifestCreatorWebpackPlugin = require("manifest-creator-webpack-plugin");

module.exports = {
  // ...
  plugins: [
    new ManifestCreatorWebpackPlugin()
  ]
}

manifest-creator-webpack-plugin will look for src/manifest.webmanifest. It will then validate the contents of the manifest. If it is valid, the plugin will then output it in your build folder as manifest.webmanifest. All icons will be emitted in an icons directory inside your build folder.

Configuration

manifest-creator-webpack-plugin works with no configuration, but you can pass a configuration object to the plugin to customize its functionality.

const ManifestCreatorWebpackPlugin = require("manifest-creator-webpack-plugin");

module.exports = {
  // ...
  plugins: [
    new ManifestCreatorWebpackPlugin({
      filename: "[id].manifest[ext]",
      source: "src/manifest.webmanifest",
      inject: true,
      
      icons: {
        filename: "[id].icon[ext]",
        folder: "icons"

        types: {
          ".webp": "image/webp"
        }
      },

      development: {
        mode: "development",
        spacing: 2
      }
    })
  ]
}

filename

Type: String

Default: "manifest.webmanifest"

The destination for the output manifest file, relative to the ouput directory. Can include the following parameters:

  • [ext]: the extension of the source manifest file
  • [id]: will always be equal to 0
  • [name]: the name of the source manifest file (excluding the extension)

source

Type: String

Default: "src/manifest.webmanifest"

The location of the source manifest file, relative to the Webpack configuration file.

inject

Type: Boolean

Default: true if html-webpack-plugin is found, otherwise false

Whether to inject a link to the manifest file inside pages generated with html-webpack-plugin.

validateManifest

Type: Boolean

Default: true

Whether to validate the source manifest file.

icons

Type: Object

Default: {}

Icon configuration (see below).

icons.filename

Type: String

Default: the name of the source icon

The destination filename for icons. Can include the following parameters:

  • [ext]: the extension of the source icon
  • [id]: an id for the icon
  • [name]: the name of the source icon

icons.folder

Type: String

Default: "icons"

The destination folder for icons, relative to the location of the output manifest file.

icons.types

Type: Object

Default:

  {
    ".jpg": "image/jpeg",
    ".jpeg": "image/jpeg",
    ".ico": "image/x-icon",
    ".png": "image/png",
    ".svg": "image/svg+xml"
  }

Types to associate with icon extensions. Overwriting one of the default values will only overwrite that value.

development

Type: Object

Default: {}

Development build options (see below).

development.mode

Type: String

Default: the mode property in webpack.config.js

The output mode to use ("development" or "production").

development.spacing

Type: Number

Default: 2

The number of spaces to use as whitespace in the output manifest file (only applies if development.mode is not "production").

2.3.17

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.3.7-dev.0

3 years ago

2.0.0

3 years ago

2.3.0-dev.1

3 years ago

2.3.0-dev.2

3 years ago

2.3.0-dev.3

3 years ago

2.3.0-dev.4

3 years ago

2.3.0-dev.0

3 years ago

2.3.8

3 years ago

2.3.7

3 years ago

2.3.9

3 years ago

2.3.0-dev.5

3 years ago

1.5.8

3 years ago

2.3.15-dev.4

3 years ago

2.3.15-dev.3

3 years ago

2.3.15-dev.0

3 years ago

2.3.15-dev.2

3 years ago

2.3.15-dev.1

3 years ago

2.3.0

3 years ago

2.3.1-beta.0

3 years ago

2.3.2

3 years ago

2.3.1

3 years ago

2.3.4

3 years ago

2.3.3

3 years ago

2.3.6

3 years ago

2.3.5

3 years ago

2.1.0

3 years ago

2.3.16

3 years ago

2.3.13

3 years ago

2.3.12

3 years ago

2.3.15

3 years ago

2.3.14

3 years ago

2.3.8-dev.0

3 years ago

2.3.11

3 years ago

2.3.10

3 years ago

1.5.7

3 years ago

1.5.5

3 years ago

1.5.4

3 years ago

1.5.3

3 years ago

1.5.6

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.10

3 years ago

1.4.9

3 years ago

1.4.8

3 years ago

1.4.7

3 years ago

1.4.6

3 years ago

1.4.5

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.9

3 years ago

1.3.8

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago