Open Assets

assets.json reference

The complete assets.json schema for Open Assets, covering root fields, collections, templates, export sizes and outputs, with types, defaults and errors.

assets.json lives at the project root (or pass --config). It is plain JSON. The CLI does no schema validation when it loads the file: it only checks that the file exists and parses. Fields are read where they are used, and /reference/cli/validate runs the explicit checks.

Annotated example

assets.json
{
  "version": 1,                         // written by init; not read by the CLI
  "name": "Skimmer Assets",             // viewer title; checked by validate
  "publicDir": "public",                // served at / by the dev server
  "command": "npx open-assets render",  // for tools and CI; not run by the CLI
  "defaultLocalization": "en",          // starting locale in the dev viewer
  "tags": [{ "id": "ios", "label": "iOS" }],
  "collections": [
    {
      "id": "screenshots",              // --collection, output folder name
      "label": "Screenshots",           // tab label
      "tags": ["ios"],                  // --tag
      "sourceSize": { "width": 440, "height": 956 },
      "borderRadius": 4,                // preview frame only
      "localizations": "localizations.json",
      "locales": ["en", "de", "ar"],
      "templates": [
        { "src": "src/screenshots/01-hero.html", "name": "01-hero", "label": "Hero" },
        { "src": "src/screenshots/02-sync.html", "name": "02-sync", "label": "Sync" }
      ],
      "export": [
        { "name": "iphone-6.9", "label": "iPhone 6.9\"", "size": { "width": 1320, "height": 2868 } },
        { "name": "ipad-13", "label": "iPad 13\"", "size": { "width": 2064, "height": 2752 } }
      ],
      "customExport": { "defaultWidth": 1320, "defaultHeight": 2868 }
    },
    {
      "id": "icon",
      "label": "App Icon",
      "sourceSize": { "width": 1024, "height": 1024 },
      "background": "#0b1020",          // opaque PNGs
      "templates": [{ "src": "src/icon.html", "name": "icon", "label": "App Icon" }],
      "export": [
        { "name": "1024", "label": "1024px", "size": { "width": 1024, "height": 1024 } },
        { "name": "favicon", "label": "Favicon", "size": { "width": 32, "height": 32 }, "outFile": "../web/public/favicon.png" },
        { "type": "xcode", "path": "../ios/Skimmer/Assets.xcassets/AppIcon.appiconset" }
      ]
    }
  ]
}

The real file must be strict JSON (no comments).

Root

Prop

Type

Collection

Prop

Type

Template

Prop

Type

name is not checked by validate, but render paths and lock keys use it; a template without one writes undefined.png.

Export entry: size

An entry without type is a size.

Prop

Type

Export entry: output

An entry with type is a post-render action. Types the code handles:

Prop

Type

Behavior of each type is on /reference/outputs.

Errors

Raised when loading, by every command:

MessageCause
<config> not found in <dir>File missing (dev prints this for invalid JSON too, followed by Run "open-assets init" to create one.)
Invalid JSON in <config>: <parser message>File does not parse

Raised while rendering:

MessageCause
No collections matched collection "<id>" in config--collection matched nothing
No collections matched tag "<tag>" in config--tag matched nothing
size "<name>" not found in collection "<id>", skippingWarning, --size
locale "<code>" not found in collection "<id>", skippingWarning, --locale
No export sizes found for collection "<id>"Log line, collection has no sizes
Localizations file not found: <path>Thrown
Invalid JSON in <path>: <message>Thrown, localizations file
Collection "<id>" has no templates for Xcode outputThrown, xcode output

The validate messages are listed on /reference/cli/validate.

Last updated on

On this page