Phenomic needs a configuration in order to start. The minimum to give is what plugins or presets you need. A minimal example configuration could be like this
Configuration source
We use comsmiconfig to load the configuration, so it’s up to you to use the format and file you want. Here are some example with the previous configure
package.json
.phenomicrc(.json)
Note that yaml is also supported in .rc files.
phenomic.config.js
Note that we recommend you to start with package.json
for simplicity and avoid the .rc hell, but that’s up to you. Some advanced options accept JavaScript, so in some case, you might end up with a phenomic.config.js
.
Options
To make this simple, here is a gigantic commented configuration. Everything is optional except having at least a few plugins
or a preset
baseUrl
(default: none)
Root of your website. This is especially handy if your website is not at a root domain In this case, development will reflect the base path. Example:
path
(default: process.cwd()
)
Root of the project. Used as root for other options like outdir
.
content
(default: { content: ["**/*"] }
)
Object that define the content to read from the filesystem that will be injected in content api. Key is used as the root for future queries.
By default it loads everything from {path}/content/**/*
.
You can load from any path you want
Note: If you provide key: [array of globs]
, key will be used as the root folder when doing your query. More on this in content api documentation
If you need relative path for a root but don’t want your queries to includes awkward paths with dots, you can send instead an object key: { root: string, globs: [array of globs]}
.
Example:
outdir
(default: "dist"
)
Location of the static website output. Note that it will be generated in the path
folder: default value will be {process.cwd()}/dist
according to default path option.
port
(default: "3333"
)
Development server port.
socketPort
(default: "3334"
)
Development socket port (used for hot loading on data).
bundleName
(default: "phenomic"
)
Prefix for javascript/css bundles used by the bundlers plugins
plugins
(default: []
)
Plugins accept various form (array/objects).
Objects are also supported but keep in mind that keys are not used (it can be used as comment).
presets
(default: none)
Presets are a function that returns a an object with plugins (and others presets in case you want to extend an existing preset).
Presets accept various form (array/objects).
Objects are supported, like for plugins.
db
(default: {}
)
Used to send some options to the database used for content api.
db.sortFunctions
Custom sort functions used for content api.