Skip to content

JSON Theme#58

Draft
alexbchr wants to merge 2 commits intodevelopfrom
feature/json-theme
Draft

JSON Theme#58
alexbchr wants to merge 2 commits intodevelopfrom
feature/json-theme

Conversation

@alexbchr
Copy link
Member

Convert Theme structure from Typescript to JSON format.

This has 2 main advantages:

  • Validate theme values and structure at build time.
  • Possibility to extract Theme (JSON files), outside the codebase (such as in a DB, remote server).

How it works?

We use JSON Schema to validate Theme JSON format.

However, since writing a JSON Schema can be lengthy and has a bit of a learning curve, we use Typescript to generate the JSON Schema. To do so, we use typescript-json-schema.

We also use ajv-cli to validate that JSON Theme files follow the defined shema. These tools are included in the build script to make sure everything will work correctly.

One possible improvement could be to be able to extend themes, a bit like before. For example, the base light theme could contain all theme keys and values, while dark theme could only specify the values it wants to override from the light theme.

@alexbchr alexbchr added the enhancement New feature or request label Jul 13, 2020
@alexbchr alexbchr requested a review from hansgx July 13, 2020 15:16
@alexbchr alexbchr self-assigned this Jul 13, 2020
@alexbchr
Copy link
Member Author

@hansgx Opened as Draft to start discussion on this 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments