PostCSS Text Decoration Shorthand lets you use text-decoration
as a shorthand following the Text Decoration Specification.
```pcss .example { text-decoration: wavy underline purple 25%; }
/ becomes /
.example { text-decoration: underline; text-decoration: underline wavy purple; text-decoration-thickness: calc(0.01em * 25); } ```
Add PostCSS Text Decoration Shorthand to your project:
bash
npm install postcss @csstools/postcss-text-decoration-shorthand --save-dev
Use it as a PostCSS plugin:
```js const postcss = require('postcss'); const postcssTextDecorationShorthand = require('@csstools/postcss-text-decoration-shorthand');
postcss([ postcssTextDecorationShorthand(/ pluginOptions /) ]).process(YOUR_CSS /, processOptions /); ```
PostCSS Text Decoration Shorthand runs in all Node environments, with special instructions for:
| Node | PostCSS CLI | Webpack | Create React App | Gulp | Grunt | | --- | --- | --- | --- | --- | --- |
The preserve
option determines whether the original notation
is preserved. By default, it is not preserved.
js
postcssTextDecorationShorthand({ preserve: true })
```pcss .example { text-decoration: wavy underline purple 25%; }
/ becomes /
.example { text-decoration: underline; text-decoration: underline wavy purple; text-decoration-thickness: calc(0.01em * 25); text-decoration: wavy underline purple 25%; } ```