question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@layer Directive doesn't work

See original GitHub issue

Related to #112 the @layer directive should work.

I’m using Vite with Vue and this directive doesn’t work properly with either a custom css file or css in a component.

This feature is important. For my case, for example, I would like to customize the forms plugin.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

0reactions
angrothemancommented, Apr 10, 2021

A possible workaround could be the creation of a plugin in your tailwind.config.js

const plugin = require('windicss/plugin')

module.exports = {
  plugins: [
    require('windicss/plugin/forms'),
    plugin(({ addBase, theme }) => {
      addBase({
        "[type='text']": {
          backgroundColor: theme('colors.red.200'),
          padding: theme('padding.2'),
        }
      })
    }),
  ],
}

Even Auto-Inferred Variables work! (theme("padding['2.5']")) But unfortunately @apply does not work. (As shown here: https://play.tailwindcss.com/gPsuO3Kx7k?file=config)

I think that’s okay for some minor modifications.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tailwind CSS @layer directive does not work - Stack Overflow
I'm trying to set base styles for my project but @layer directive does not seem to work. My package.json : { "name": "tailwind-base-layer", ......
Read more >
Custom class need to be declared inside layer directive #5989
I am getting an error randomly on my NextJS application where it gives a message telling me I have to declare a custom...
Read more >
Functions & Directives - Tailwind CSS
Use the @layer directive to tell Tailwind which “bucket” a set of custom styles belong to. Valid layers are base , components ,...
Read more >
Organize your CSS in the Tailwind style with @layer directive
Tailwind provides a @layer directive to help you better organize your CSS. This post is a detailed breakdown of the directive for my...
Read more >
the `@apply` class does not exist. if `@apply` is a custom ...
The text-paragraph class does not exist. If text-paragraph is a custom class, make sure it is defined within a @layer directive. E:/XAMPP/htdocs ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found