Skip to content

vormkracht10/tailwindcss-debug-containers

This branch is 1 commit ahead of, 8 commits behind jorenvanhee/tailwindcss-debug-screens:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

18a21e5 Â· Nov 20, 2024

History

28 Commits
Oct 29, 2019
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 17, 2019

Repository files navigation

Tailwind CSS Debug Containers 📱

A Tailwind CSS component that shows the currently active container (responsive breakpoint).

Demo

Install

Requires Tailwind v1.0 or higher.

  1. Install the plugin:
npm install tailwindcss-debug-containers --save-dev
  1. Add it to your tailwind.config.js file:
// tailwind.config.js
module.exports = {
  //...
  plugins: [require("tailwindcss-debug-containers")],
};
  1. Add the class debug-containers to your <body> tag:
<body class="debug-containers"></body>

Disable in production

Laravel

<body class="{{ app()->isLocal() ? 'debug-containers' : '' }}">

Craft CMS

<body class="{{ devMode ? 'debug-containers' : '' }}">

Customization

You can customize this plugin in the theme.debugContainers section of your tailwind.config.js file.

Ignore containers

To ignore a specific container (for instance dark mode), add the container name to the ignore configuration array. dark is ignored by default.

// tailwind.config.js
module.exports = {
  theme: {
    debugContainers: {
      ignore: ["dark"],
    },
  },
  plugins: [require("tailwindcss-debug-containers")],
};

Position

The first item of the position configuration array can be top or bottom, the second item can be left or right.

// tailwind.config.js
module.exports = {
  theme: {
    debugContainers: {
      position: ["bottom", "left"],
    },
  },
  plugins: [require("tailwindcss-debug-containers")],
};

Styles

Take a look at the index.js file to see all the default styles.

// tailwind.config.js
module.exports = {
  theme: {
    debugContainers: {
      style: {
        backgroundColor: "#C0FFEE",
        color: "black",
        // ...
      },
    },
  },
  plugins: [require("tailwindcss-debug-containers")],
};

Prefix

Modify the debug label prefix with the prefix configuration option.

// tailwind.config.js
module.exports = {
  theme: {
    debugContainers: {
      prefix: "container: ",
    },
  },
  plugins: [require("tailwindcss-debug-containers")],
};

Selector

Modify the debug element selector with the selector configuration option.

// tailwind.config.js
module.exports = {
  theme: {
    debugContainers: {
      selector: ".debug-containers",
    },
  },
  plugins: [require("tailwindcss-debug-containers")],
};

About

A Tailwind CSS component that shows the active responsive breakpoint per container.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%