With this plugin, you can add Sanity as a data source for Sourcebit. To connect your Sanity account, you need an API token, your project ID and the name of your dataset.
To install the plugin and add it to your project, run:
npm install sourcebit-source-sanity --save
💡 You don't need to run this command if you start Sourcebit using the interactive setup process, as the CLI will install the plugin for you and add it as a dependency to your project.
The plugin accepts the following configuration parameters. They can be supplied in any of the following ways:
- In the
optionsobject of the plugin configuration block insidesourcebit.js, with the value of the Property column as a key; - As an environment variable named after the Env variable column, when running the
sourcebit fetchcommand; - As part of a
.envfile, with the value of the Env variable column separated by the value with an equals sign (e.g.MY_VARIABLE=my-value); - As a CLI parameter, when running the
sourcebit fetchcommand, using the value of the Parameter column as the name of the parameter (e.g.sourcebit fetch --my-parameter).
sourcebit.js
module.exports = {
plugins: [
{
module: require('sourcebit-source-sanity'),
options: {
accessToken: process.env['SANITY_ACCESS_TOKEN'],
dataset: 'production',
projectId: '1q2w3e4r'
}
}
]
};.env
SANITY_ACCESS_TOKEN=123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
This plugin offers an interactive setup process via the npx create-sourcebit command.
N/A
This plugin adds normalized entries to the objects data bucket.
