Description
In frontity themes are structurally the same than any other package. But treating them at the same level has some problems to start understanding how Frontity work:
- Themes are a special type of packages (the most important one?) because no frontity project has sense without a theme
- For wordpress developers a theme and plugins (packages) are separated concepts and easier to understand
- With the current way of defining a frontity project through
frontity.settings.js
you have to understand to start working with a theme- Namespaces (a namespace is asked when
create-package
and in frontity.seetings.js you see things such asstate.theme.someThing
- Packages
- Packages are organized though namespaces
- Namespaces (a namespace is asked when
Examples
Possible solution
We think it would make sense to separate the definition of a theme in a frontity project to make it easuer to understand . Something like…
"theme": {
"name": "@frontity/twenty-twenty-theme",
"state": {
"featured": {
"showOnList": true,
"showOnPost": false
}
},
"actions": {
}
},
In this way:
- It would be easier to detect and understand the concept of theme in a frontity project
- You won’t have to especify any namespace (this is important because the concept of namespaces won’t be necesary to be explained for introducing Frontity)
Also it would be easier to understand and explain themes (only state
and actions
would be relevant)
The final frontity.settings.js
could be something like this one…
const settings = {
"name": "webdevstudios-demo",
"state": {
"frontity": {
"url": "https://test.frontity.org",
"title": "Test Frontity Blog",
"description": "WordPress installation for Frontity development"
}
},
"theme": {
"name": "@frontity/twenty-twenty-theme",
"state": {
"featured": {
"showOnList": true,
"showOnPost": false
}
},
"actions": {
}
},
"packages": [
{
"name": "@frontity/wp-source",
"state": {
"source": {
"api": "https://test.frontity.org/wp-json"
}
}
},
{
"name": "@frontity/menu",
"state": {
"menu": [
[
"Home",
"/"
],
[
"Nature",
"/category/nature/"
],
[
"Travel",
"/category/travel/"
],
[
"Japan",
"/tag/japan/"
],
[
"About Us",
"/about-us/"
]
]
}
},
"@frontity/tiny-router",
"@frontity/html2react"
]
};
export default settings;