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

options param is not populated when running preprocessor at platform level #1365

Open
bigglesrocks opened this issue Oct 11, 2024 · 0 comments

Comments

@bigglesrocks
Copy link

bigglesrocks commented Oct 11, 2024

I have a custom preprocessor which I want to run only on a single platform, however I want access to the config via the options param that is passed to the preprocess function. If I specify this preprocessor at the root level, the options param is populated with the config as expected, however, specified on a single platform, the options object is empty. I would expect to get either the full config object or platform configuration, preferably both.

// config.js
{
  hooks: { 
   preprocessors: { 
    'my-custom-preprocessor': (tokens, options) => {
     console.log(options);
    }
   },
  // when specified at the root level, the console statement in the preprocessor function
  // will log out this config object as expected 👍
    preprocessors: ['my-custom-preprocessor'],  
    platforms: {
      css: { 
        files: [{ // basic css file }],
        transformGroup: 'css',
        // when specified on a platform, the console statement only logs an empty object: {} 😢
        preprocessors: ['my-custom-preprocessor'], 
      }
    }
  }
}

I've tested this in a barebones StyleDictionary project using v4.1.3. Also want to note that it makes no difference whether the preprocessor is defined inline like in the example or registered with registerPreprocessor.

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

No branches or pull requests

1 participant