🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

tailwindcss-pseudo-elements

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tailwindcss-pseudo-elements

TailwindCSS Plugin that adds variants of pseudo elements.

1.3.0
Source
npm
Version published
Weekly downloads
3.8K
22.55%
Maintainers
2
Weekly downloads
 
Created
Source

tailwindcss-pseudo-elements

TailwindCSS Plugin that adds variants of pseudo elements (::before, ::after, ::first-letter, etc.).

Usage

Install

NPM

npm install tailwindcss-pseudo-elements --save-dev

Yarn

yarn add tailwindcss-pseudo-elements -D

Configuration

const plugin = require("tailwindcss/plugin");

module.exports = {
  variants: {
    textColor: [
      "responsive",
      "hover",
      "focus",
      "before",
      "after",
      "hover_before",
      "hover_after",
      "focus_before",
    ],
  },

  plugins: [
    require("tailwindcss-pseudo-elements"),
    // This plugin is useful in combination with tailwindcss-aspect-ratio.
    require("tailwindcss-aspect-ratio")({
      ratios: {
        "16/9": [16, 9],
        "4/3": [4, 3],
        "3/2": [3, 2],
        "1/1": [1, 1],
      },
      variants: ["before", "hover_before", "responsive"],
    }),
    plugin(function ({ addUtilities }) {
      addUtilities(
        {
          ".empty-content": {
            content: "''",
          },
        },
        ["before"]
      );
    }),
  ],
};

HTML

<div
  class="relative
    before:aspect-ratio-4/3
    hover:before:aspect-ratio-1/1
    before:empty-content"
>
  <img class="absolute pin w-full h-full" src="..." />
</div>

Keywords

tailwindcss

FAQs

Package last updated on 28 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts