postcss-glitch
Glitch effect implemented with PostCSS. With this plugin you can easily add glitch effect to any text!
Check out our demo page (source)
Installation
yarn add postcss-glitch
You can use .postcssrc.js
to add plugin to your project just like this:
// postcss.config.js.js moduleexports = plugins: 'postcss-import': {} 'postcss-glitch': {} 'postcss-url': {} autoprefixer: {} ;
Usage
TL;DR
.foo {
glitch: <height in px | pt | % | em | rem > <first color> <second color> <shadow size>;
}
Guide
- Create a positioned element
- Create element which you want to apply glitch effect
PostCSS Glitch
- Add data-text attribute to the last created element
PostCSS Glitch
What actually happens?
transforms to
@ 25% 50% 75% } @ 25% 50% 75% }
And yeah it also works with CSSModules!
Testing
There are 2 major groups of tests in this project:
- Tests that are running against source code powered with jest
# running jest in the watch mode yarn workspace postcss-glitch jest # or alternatively run it without watch mode as it runs on CI server yarn workspace postcss-glitch test
If you're having difficulties with running in watch mode see the installation guide
- End-to-end tests powered with cypress
# opening cypress yarn workspace postcss-glitch cypress open # running cypress in headless mode yarn workspace postcss-glitch cypress run
Make sure the page under test is up and running at http://localhost:1234 before opening cypress.
Please respect our tests and make sure that any new behaviour or any change to the existing behaviour is properly reflected in tests.