Skip to content

A plugin to customise the order Tailwind applies CSS filters

Notifications You must be signed in to change notification settings

joshdavenport/tailwindcss-filter-order

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tailwind CSS Filter Order

A plugin to order your CSS filters applied by Tailwind CSS. Order of filters passed to the filter property can drastically change the final result. Without use of this plugin filters are applied in the same order every time because Tailwind has a hardcoded order.

Installation

# npm
npm install --save-dev @joshdavenport/tailwindcss-filter-order

# yarn
yarn add --dev @joshdavenport/tailwindcss-filter-order

# pnpm
pnpm install --save-dev @joshdavenport/tailwindcss-filter-order

Usage

// tailwindcss.config.js
module.exports = {
  theme: {
    extend: {
      filterOrder: {
        'my-order': 'sepia invert brightness',
        'another-order': 'brightness sepia hue-rotate invert'
      },
    },
  },
  plugins: [
    require('@joshdavenport/tailwindcss-filter-order')
  ]
}

This generates the following new Tailwind utilities, for use in combination with the OOTB filter utilities (brightness, contrast, sepia, etc):

filter-order-my-order
filter-order-another-order

Alternatively, you can use an arbitrary value passed to the utility:

filter-order-[sepia_invert_brightness]

About

A plugin to customise the order Tailwind applies CSS filters

Resources

Stars

Watchers

Forks

Packages

No packages published