https://github.com/csstools/postcss-short-overflow
Write overflow-x and overflow-y with the overflow shorthand in CSS
https://github.com/csstools/postcss-short-overflow
Last synced: about 1 year ago
JSON representation
Write overflow-x and overflow-y with the overflow shorthand in CSS
- Host: GitHub
- URL: https://github.com/csstools/postcss-short-overflow
- Owner: csstools
- License: cc0-1.0
- Created: 2018-10-09T14:06:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-10T12:14:41.000Z (over 7 years ago)
- Last Synced: 2024-05-22T18:31:21.408Z (about 2 years ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 2
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# PostCSS Short Overflow [
][postcss]
[![NPM Version][npm-img]][npm-url]
[![Build Status][cli-img]][cli-url]
[![Support Chat][git-img]][git-url]
[PostCSS Short Overflow] lets you write `overflow-x` and `overflow-y` with the
`overflow` shorthand in CSS.
```pcss
html {
overflow: hidden auto;
}
[contenteditable] {
overflow: * auto;
}
/* becomes */
html {
overflow-x: hidden;
overflow-y: auto;
}
[contenteditable] {
overflow-y: auto;
}
```
## Usage
Add [PostCSS Short Overflow] to your project:
```bash
npm install postcss-short-overflow --save-dev
```
Use [PostCSS Short Overflow] to process your CSS:
```js
const postcssShortOverflow = require('postcss-short-overflow');
postcssShortOverflow.process(YOUR_CSS /*, processOptions, pluginOptions */);
```
Or use it as a [PostCSS] plugin:
```js
const postcss = require('postcss');
const postcssShortOverflow = require('postcss-short-overflow');
postcss([
postcssShortOverflow(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```
[PostCSS Short Overflow] runs in all Node environments, with special instructions for:
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- | --- |
## Options
#### prefix
The `prefix` option defines a prefix required by properties being transformed.
Wrapping dashes are automatically applied, so that `x` would transform
`-x-overflow`.
```js
postcssShortOverflow({ prefix: 'x' });
```
```pcss
html {
-x-overflow: hidden auto;
}
/* becomes */
html {
overflow-x: hidden;
overflow-y: auto;
}
```
#### skip
The `skip` option defines the skip token used to ignore portions of the
shorthand.
```js
postcssShortOverflow({ skip: '-' });
```
```pcss
[contenteditable] {
overflow: - auto;
}
/* becomes */
[contenteditable] {
overflow-y: auto;
}
```
[cli-img]: https://img.shields.io/travis/jonathantneal/postcss-short-overflow.svg
[cli-url]: https://travis-ci.org/jonathantneal/postcss-short-overflow
[git-img]: https://img.shields.io/badge/support-chat-blue.svg
[git-url]: https://gitter.im/postcss/postcss
[npm-img]: https://img.shields.io/npm/v/postcss-short-overflow.svg
[npm-url]: https://www.npmjs.com/package/postcss-short-overflow
[PostCSS]: https://github.com/postcss/postcss
[PostCSS Short Overflow]: https://github.com/jonathantneal/postcss-short-overflow