https://github.com/yanhaijing/postcss-custom-unit
[PostCSS] plugin custom unit
https://github.com/yanhaijing/postcss-custom-unit
Last synced: 3 months ago
JSON representation
[PostCSS] plugin custom unit
- Host: GitHub
- URL: https://github.com/yanhaijing/postcss-custom-unit
- Owner: yanhaijing
- License: mit
- Created: 2019-03-11T07:14:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-11-03T15:21:10.000Z (over 2 years ago)
- Last Synced: 2024-10-11T23:27:33.314Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 56.6 KB
- Stars: 14
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# PostCSS Custom Unit [![Build Status][ci-img]][ci]
[PostCSS] plugin custom unit, custom convert function.
```css
.foo {
width: 100munit;
padding: 100munit 200munit;
}
``````css
.foo {
width: 200rem;
padding: 200rem 400rem;
}
```## Usage
```js
postcss([ require('postcss-custom-unit') ])
```See [PostCSS] docs for examples for your environment.
## Option
- includePath custom include path
- units custom unit and convert function```js
var customUnit = require("postcss-custom-unit")module.exports = ctx => ({
plugins: [
customUnit({
includePath: /xxxx/,
units: [{ from: 'munit', convert: function (val) { return val * 2 + 'rem' }}]
})
]
})
```[PostCSS]: https://github.com/postcss/postcss
[ci-img]: https://travis-ci.org/yanhaijing/postcss-custom-unit.svg
[ci]: https://travis-ci.org/yanhaijing/postcss-custom-unit