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

Plugin Warning #25

Open
flamedfury opened this issue Dec 5, 2023 · 3 comments
Open

Plugin Warning #25

flamedfury opened this issue Dec 5, 2023 · 3 comments

Comments

@flamedfury
Copy link
Contributor

Hey Lene,

Any idea what plugin is tripping this warning?

flamed@flamedfury:~/Projects/eleventy-excellent$ npm run start

> eleventy-excellent@1.6.3 start
> run-p dev:*


> eleventy-excellent@1.6.3 dev:11ty
> eleventy --serve --watch


warn - Your plugin must set `modifiers: true` in its options to support modifiers.
@madrilene
Copy link
Owner

madrilene commented Dec 5, 2023

I think it was related to postCSS.. or Tailwind. have been ignoring that one 😅

@madrilene
Copy link
Owner

Try adding it to the tailwind config.

@oddigy
Copy link

oddigy commented Dec 9, 2023

Plugins don't explicitly support modifiers, and therefore, we need to manually configure them to handle modifiers.
I have added { modifiers: true } to the end of the 2 plugin functions, but I still have the warning.
plugins: [
// Generates custom property values from tailwind config
plugin(function ({addComponents, config}) {
let result = '';

  const currentConfig = config();

  const groups = [
    {key: 'colors', prefix: 'color'},
    {key: 'spacing', prefix: 'space'},
    {key: 'fontSize', prefix: 'size'},
    {key: 'fontFamily', prefix: 'font'}
  ];

  groups.forEach(({key, prefix}) => {
    const group = currentConfig.theme[key];

    if (!group) {
      return;
    }

    Object.keys(group).forEach(key => {
      result += `--${prefix}-${key}: ${group[key]};`;
    });
  });

  addComponents({
    ':root': postcssJs.objectify(postcss.parse(result))
  });
//}),
}, { modifiers: true }),

// Generates custom utility classes
plugin(function ({  addUtilities, config}) {
  const currentConfig = config();
  const customUtilities = [
    {key: 'spacing', prefix: 'flow-space', property: '--flow-space'},
    {key: 'colors', prefix: 'spot-color', property: '--spot-color'}
  ];

  customUtilities.forEach(({key, prefix, property}) => {
    const group = currentConfig.theme[key];

    if (!group) {
      return;
    }

    Object.keys(group).forEach(key => {
      addUtilities({
        [`.${prefix}-${key}`]: postcssJs.objectify(
          postcss.parse(`${property}: ${group[key]}`)
        )
      });
    });
  });
}, { modifiers: true })

]

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

3 participants