Replies: 1 comment 1 reply
-
Nice one setting up this discussion. I'll paste in my thoughts from our chat: Transformers are logically tethered pretty close to sources, as the source output can be unusable to Flatbread until it’s parsed and transformed to JSON. I like the idea of being direct about how a source gets transformed. To that end, we can simplify the plugin API by making transformation the responsibility of the source plugin. With multiple sources, a user could then easily reuse the same transformer config or break away from it per-call of the transformer on different sources. // NOTES:
// - Plugin order matters!
export default defineConfig({
plugins: [
sourceFilesystem({
transformers: [transformYaml(), transformMarkdown()],
content: {
Author: {
path: 'content/yaml/authors',
refs: {
friend: 'Author',
},
},
Post: {
path: 'content/markdown/posts',
refs: {
authors: 'Author',
},
},
},
}),
sourcePostgres({
connection: 'psql://asdfasdf',
content: {
Cat: {
table: 'cat',
},
},
}),
fieldOverrides({
content: {
Author: [
{ field: 'deeply.nested', type: 'String', resolve: () => {} },
],
},
}),
svimgFields({
defaultConfig: {
inputDir: 'static/authorImages',
outputDir: 'static/g',
srcGenerator: (path) => '/g/' + path,
},
content: {
// can supply svimg config to override defaults per field
Author: [{ field: 'deeply.nested' }],
},
}),
],
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This will allow for multiple sources and allow for more advanced plugins when they all have access to a more streamlined interface api
Open Questions:
Beta Was this translation helpful? Give feedback.
All reactions