Can Ghost theme configuration move outside package.json?

Question about theme configuration outside package.json

Hi everyone,

I’m currently working on a Ghost theme and noticed that some theme configuration values are defined inside the config section of the package.json file.

Example from my theme:

"config": {
  "card_assets": {
    "exclude": [
      "audio",
      "blockquote",
      "bookmark",
      "button",
      "callout",
      "collection",
      "gallery",
      "header",
      "header_v2",
      "nft",
      "product",
      "signup",
      "toggle",
      "video"
    ],
    "x-include": []
  },
  "image_sizes": {
    "l": { "width": 1200 },
    "m": { "width": 600 },
    "s": { "width": 300 },
    "xl": { "width": 2000 },
    "xs": { "width": 100 },
    "xxs": { "width": 30 }
  },
  "posts_per_page": 15
}

However, when running npm commands I get warnings like these:

npm warn Unknown cli config "image_sizes_m_width" (merisia-llc-theme:image_sizes_m_width). This will stop working in the next major version of npm.
npm warn Unknown cli config "image_sizes_xl_width" (merisia-llc-theme:image_sizes_xl_width). This will stop working in the next major version of npm.
npm warn Unknown cli config "image_sizes_s_width" (merisia-llc-theme:image_sizes_s_width). This will stop working in the next major version of npm.
npm warn Unknown cli config "image_sizes_xs_width" (merisia-llc-theme:image_sizes_xs_width). This will stop working in the next major version of npm.
npm warn Unknown cli config "image_sizes_xxs_width" (merisia-llc-theme:image_sizes_xxs_width). This will stop working in the next major version of npm.
npm warn Unknown cli config "card_assets_exclude_0" (merisia-llc-theme:card_assets_exclude_0). This will stop working in the next major version of npm.
npm warn Unknown cli config "posts_per_page" (merisia-llc-theme:posts_per_page). This will stop working in the next major version of npm.

My current npm version is:

npm 11.3.0

My question

Is it possible (or recommended) to define this kind of theme configuration outside of package.json?

For example in a dedicated configuration file such as:

  • theme.config.json
  • ghost.config.json
  • or something similar

The goal would be to avoid npm interpreting the config section as CLI configuration and generating these warnings.

Or is the config section in package.json still the expected/official approach for Ghost themes, and these warnings can simply be ignored?

Thanks in advance for any clarification!

The config key has to stay in package.json: Ghost reads it when the theme is activated (posts_per_page, image_sizes, card_assets, and config.custom for the Design settings) and GScan validates it there. There is no alternative file. The npm warnings come from npm treating the config key as its own CLI config namespace, so it flags every key it does not recognise. They are harmless and you can ignore them. If they bother you, pnpm does not emit them in my experience, and you get the same lockfile discipline.