npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

postcss-glitch

v7.0.1

Published

PostCSS plugin for glitch effect

Readme

postcss-glitch

Glitch effect implemented with PostCSS. With this plugin you can add a glitch effect to any text!

NPM Version CI

Check out our demo page (source)

Installation

npm install postcss-glitch

You can use postcss.config.js to add plugin to your project just like this:

// postcss.config.js

module.exports = {
	plugins: [
		require('postcss-glitch'),
		require('autoprefixer'),
	],
}

Usage

TL;DR

.foo {
  glitch: <glitch mode> <height in px | pt | % | em | rem > <first color> <second color> <shadow size>;
}

Guide

SVG mode
  1. Create an element which you want to apply a glitch effect
<div class="glitch_svg"></div>
.glitch_svg {
    background-image: url("awesome.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    width: 100px;
    height: 100px;
}
  1. Add glitch property with mode svg
.glitch_svg {
    background-image: url("awesome.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    width: 100px;
    height: 100px;
    glitch: svg 60% #f00 #00f 2px;
}
Text mode
  1. Create an element which you want to apply a glitch effect
<div class="glitch">PostCSS Glitch</div>
  1. Add a data-text attribute to the last created element
<div class="glitch" data-text="PostCSS Glitch">PostCSS Glitch</div>
  1. Add glitch property with mode text
.glitch {
	font-weight: 700;
	font-size: 23pt;
	glitch: text 42px #f00 #00f 2px;
}

What actually happens?

❗️Note that .glitch element becomes a positioning context for its pseudo-elements

.glitch {
	font-weight: 700;
	font-size: 23pt;
	glitch: text 42px #f00 #00f 2px;
}

transforms to

@keyframes glitch-animation-before {
	0% {
		clip-path: inset(5px 0 32px 0);
	}
	25% {
		clip-path: inset(14px 0 23px 0);
	}
	50% {
		clip-path: inset(15px 0 22px 0);
	}
	75% {
		clip-path: inset(11px 0 26px 0);
	}
	to {
		clip-path: inset(18px 0 19px 0);
	}
}

@keyframes glitch-animation-after {
	0% {
		clip-path: inset(20px 0 17px 0);
	}
	25% {
		clip-path: inset(37px 0 0 0);
	}
	50% {
		clip-path: inset(16px 0 21px 0);
	}
	75% {
		clip-path: inset(20px 0 17px 0);
	}
	to {
		clip-path: inset(17px 0 20px 0);
	}
}

.glitch {
	position: relative;
	font-weight: 700;
	font-size: 23pt;
}

.glitch:after,
.glitch:before {
	content: attr(data-text);
	position: absolute;
	top: 0;
	left: 0;
	overflow: hidden;
	clip-path: inset(42px 0 0 0);
}

.glitch:before {
	text-shadow: -2px 0 #f00;
	animation: glitch-animation-before 3s infinite linear alternate-reverse;
}

.glitch:after {
	text-shadow: 2px 0 #00f;
	animation: glitch-animation-after 2s infinite linear alternate-reverse;
}

And yeah, it also works with CSSModules!

Testing

There are two major groups of tests in this project:

  • Tests that are running against source code powered with jest
# running jest in the watch mode
pnpm --filter postcss-glitch jest

# or alternatively run it without watch mode as it runs on CI server
pnpm --filter postcss-glitch test

If you're having difficulties with running in watch mode see the installation guide