A Contentful source plugin for Sourcebit
With this plugin, you can add Contentful as a data source for Sourcebit. To connect your Contentful account, you need a Personal Access Token.
To install the plugin and add it to your project, run:
npm install sourcebit-source-contentful --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-contentful'),
options: {
accessToken: process.env['CONTENTFUL_ACCESS_TOKEN'],
environment: 'master',
spaceId: '1abcdefgh2ij'
}
}
]
};.env
CONTENTFUL_ACCESS_TOKEN=CFPAT-123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
This plugin offers an interactive setup process via the npx create-sourcebit command. It asks users for their Contentful Personal Access Token and allows them to select their Contentful space and environment.
N/A
This plugin adds normalized entries and assets to the objects data bucket and normalized model objects to the models data bucket.
