Configuration options for custom template

System Information
  • Strapi Version: 4.4.3
  • Database: sqlite
  • Node Version: 16

I’m looking for information about how to handle configuration when creating a custom Strapi template.

The documentation says that a template is not allowed to include the ‘config’ folder. Can any of the configurations that are normally handled in the config folder be handled some other way when creating a custom template?

A more specific question/example:

A custom template allows for including plugin packages by adding them to a ‘template.json’ file at the root of template repository.

If I were to add

// path: ./template.json

{
  "package": {
    "dependencies": {
      "@_sh/strapi-plugin-ckeditor": "^1.1.2"
    }
  }
}

How would I configure the ckeditor?


Note: As of this writing, there isn’t any official documentation for creating templates for version 4 of Strapi. See “Fix template docs for v4 #665”. A draft version of the docs can be found if you piece together the auto-created preview link in that discussion with “/developer-docs/latest/setup-deployment-guides/installation/templates.html”

For reference, the draft instructions for Strapi version 4 includes this about file structures:

File structure

The root of the template repository can include as many files as necessary but must include at least:

  • a template folder,
  • a package.json file,
  • and a template.json file.

The template.json is used to extend the Strapi application’s default package.json. All properties overwriting the default package.json should be included in a root package property:

// path: ./template.json

{
  "package": {
    "dependencies": {
      "strapi-plugin-graphql": "^4.0.0"
    },
    "scripts": {
      "custom": "node ./scripts/custom.js"
    }
  }
}

The template directory is used to extend the file contents of a Strapi project and should only include the files that will overwrite the default Strapi app.

Only the following contents are allowed inside the template directory:

  • README.md: the readme of an app made with this template
  • .env.example to specify required environment variables
  • src/
  • data/ to store the data imported by a seed script
  • public/ to serve files
  • scripts/ for custom scripts

:raised_hand: CAUTION

If any unexpected file or directory is found, the installation will crash.