Skip to content

Manifest


Customize build behavior for extension manifest.


In your build configuration specify path to the manifest file:

1
2
3
"xtbuild": {
   "manifest": "./src/manifest.json",
} 

The file will be renamed to manifest.json during build regardless of its original name.

Customizing manifests for different target browsers

There are two strategies for customizing the manifest contents per target browser:

  1. Specify browser-specific keys in single manifest file
  2. Specify multiple build configurations, each with different manifest file.

Browser specific keys in single manifest

Using this strategy, the project contains single manifest. In manifest.json:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
  "name": "__MSG_appname__",
  "description": "__MSG_description__",
  "chrome":{

     ... chrome-specific manifest keys here

  },
  "firefox":{

     ... firefox-specific manifest keys here

  }
}

Then run the build command specifying the target platform:

1
2
xt-build --platform chrome  
xt-build --platform firefox

The build will then combine all common manifest elements with those specified for the target platform.

When building cross-browser extensions, most browsers can reuse the same manifest. Therefore, these two targets are typically sufficient to generate the desired manifests for multiple target browsers. However, if this strategy is insufficient, see the next option.

Multiple build configurations

Create multiple build configuration files:

chrome-config.json:

1
2
3
{
  "manifest": "./manifests/chrome.json"
} 

firefox-config.json:

1
2
3
{
  "manifest": "./manifests/firefox.json"
} 

Using this strategy, run the build command specifying path to config file explicitly:

1
2
xt-build --config chrome-config.json  
xt-build --config firefox-config.json