Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config structure for using multiple transformers with source-filesystem #401

Open
namoda378 opened this issue May 1, 2019 · 1 comment
Open
Assignees
Labels

Comments

@namoda378
Copy link

@namoda378 namoda378 commented May 1, 2019

Description

The current configuration file structure seems a bit awkward when using multiple transformers with source-filesystem plugin.

What I Expected to Work

{
      use: '@gridsome/source-filesystem',
      options:[
        {
          path: 'markdowns/**/*.md',
          typeName: 'Markdown',
          remark: {
            plugins: [
              // ...local plugins
            ]
          }
        },
        {
          path: 'yamls/**/*.yaml',
          typeName: 'Yaml',
          yaml: {
            plugins: [
              // ...local plugins
            ]
          }
        },
      ] 
    },

What Actually Works

 plugins:[ {
      use: '@gridsome/source-filesystem',
      options: 
        {
          path: 'markdowns/**/*.md',
          typeName: 'Markdown',
          remark: {
            plugins: [
              // ...local plugins
            ]
          }
        }
    },
    {
      use: '@gridsome/source-filesystem',
      options: 
        {
          path: 'yamls/**/*.yaml',
          typeName: 'Yaml',
          yaml: {
            plugins: [
              // ...local plugins
            ]
          }
        }
    }],

The difference is that what I expected is that you should only state the usage of a plugin once and give multiple options. But what actually works is when you state that you use the plugin twice with different options

I know this is a very trivial issue but this seems more consistent with how webpack configs are written. I find it a bit awkward, never mind if it's just me.

@kaceo

This comment has been minimized.

Copy link

@kaceo kaceo commented May 12, 2019

Yes it seems quite awkward, and also the gridsome.config.js can get rather complicated and hard to read in a project with many data sources (e.g. an ecommerce site, dozens of schemas).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.