postcss-all-link-colors
PostCSS plugin to insert colors for link-related pseudo-classes.
Introduction
Adding link-related pseudo-classes can be a total pain. Just look at how much garbage we have to write!
This plugin allows you to simplify the above syntax into the following:
You can override individual pseudo-classs like so:
}
This transpiles into:
Of course, you don't have to color all link-related pseudo-classes if you don't want. Just get rid of the all
parameter to make the colors inclusive:
}
This transpiles into:
Link-related pseudo-classes are written in LVHA-order: :link
— :visited
— :hover
— :active
with the following variations:
- The
:link
pseudo-class is replaced by justcolor
, as it covers not only links, but buttons and other elements as well. - The
:focus
pseudo-class is placed before or after:hover
, depending on the order in which you specify it; thus, the desired effect.
Installation
$ npm install postcss-all-link-colors
Usage
JavaScript
;
TypeScript
; postcss;
Options
None at this time.
Testing
Run the following command:
$ npm test
This will build scripts, run tests and generate a code coverage report. Anything less than 100% coverage will throw an error.
Watching
For much faster development cycles, run the following command:
$ npm run watch
This will build scripts, run tests and watch for changes.