I try to install and use a plugin tailwind-scrollbar-hide. After adding the plugin via yarn add tailwind-scrollbar-hide, I also added the plugin in tailwind.config.js:
After I run the yarn build command, the below error show:
│ │ Module build failed (from ../node_modules/postcss-loader/dist/cjs.js):
│ │ SyntaxError
│ │ (235:13) resources/styles/home.css The `max-mobile:scrollbar-hide` class does not exist. If `max-mobile:scrollbar-hide` is a custom class, make sure it is defined within a `@layer` directive.
Where did this come from? Is there a reason why you’re doing this?
Using require when adding Tailwind plugins isn’t going to work on a Sage 10 setup, you’ll need to use import. A couple recently updated topics that cover this:
Thanks for your reply, Ben. I tried to use import and same error message when running yarn build
│ │ Module build failed (from ../node_modules/postcss-loader/dist/cjs.js):
│ │ SyntaxError
│ │ (235:13) resources/styles/home.css The `max-mobile:scrollbar-hide` class does not exist. If `max-mobile:scrollbar-hide` is a custom class, make sure it is defined within a `@layer` directive.
It seems bud does not include the plugin when building the project, so putting the plugin in tailwind.config.js is a proper approach? Any extra steps required? Thanks.
The styles from the plugin are working as expected.
I’m not really understanding what you’re trying to do from your resources/styles/home.css file. Is there a specific reason why you’re using @apply in CSS files instead of using Tailwind classes in template/component files?