[6a3a178] | 1 | # [postcss][postcss]-reduce-initial
|
---|
| 2 |
|
---|
| 3 | > Reduce `initial` definitions to the _actual_ initial value, where possible.
|
---|
| 4 |
|
---|
| 5 | ## Install
|
---|
| 6 |
|
---|
| 7 | With [npm](https://npmjs.org/package/postcss-reduce-initial) do:
|
---|
| 8 |
|
---|
| 9 | ```
|
---|
| 10 | npm install postcss-reduce-initial --save
|
---|
| 11 | ```
|
---|
| 12 |
|
---|
| 13 | ## Examples
|
---|
| 14 |
|
---|
| 15 | See the [data](data) for more conversions. This data is courtesy
|
---|
| 16 | of Mozilla.
|
---|
| 17 |
|
---|
| 18 | ### Convert `initial` values
|
---|
| 19 |
|
---|
| 20 | When the `initial` keyword is longer than the property value, it will
|
---|
| 21 | be converted:
|
---|
| 22 |
|
---|
| 23 | #### Input
|
---|
| 24 |
|
---|
| 25 | ```css
|
---|
| 26 | h1 {
|
---|
| 27 | min-width: initial;
|
---|
| 28 | }
|
---|
| 29 | ```
|
---|
| 30 |
|
---|
| 31 | #### Output
|
---|
| 32 |
|
---|
| 33 | ```css
|
---|
| 34 | h1 {
|
---|
| 35 | min-width: 0;
|
---|
| 36 | }
|
---|
| 37 | ```
|
---|
| 38 |
|
---|
| 39 | ### Convert values back to `initial`
|
---|
| 40 |
|
---|
| 41 | When the `initial` value is smaller than the property value, it will
|
---|
| 42 | be converted:
|
---|
| 43 |
|
---|
| 44 | #### Input
|
---|
| 45 |
|
---|
| 46 | ```css
|
---|
| 47 | h1 {
|
---|
| 48 | transform-box: border-box;
|
---|
| 49 | }
|
---|
| 50 | ```
|
---|
| 51 |
|
---|
| 52 | #### Output
|
---|
| 53 |
|
---|
| 54 | ```css
|
---|
| 55 | h1 {
|
---|
| 56 | transform-box: initial;
|
---|
| 57 | }
|
---|
| 58 | ```
|
---|
| 59 |
|
---|
| 60 | This conversion is only applied when you supply a browsers list that all support
|
---|
| 61 | the `initial` keyword; it's worth noting that Internet Explorer has no support.
|
---|
| 62 |
|
---|
| 63 | ## API
|
---|
| 64 |
|
---|
| 65 | ### reduceInitial([options])
|
---|
| 66 |
|
---|
| 67 | #### options
|
---|
| 68 |
|
---|
| 69 | ##### ignore
|
---|
| 70 |
|
---|
| 71 | Type: `Array<String>`
|
---|
| 72 | Default: `undefined`
|
---|
| 73 |
|
---|
| 74 | It contains the Array of properties that will be ignored while reducing its value to initial.
|
---|
| 75 | Example : `{ ignore : ["min-height"] }`
|
---|
| 76 |
|
---|
| 77 | ## Usage
|
---|
| 78 |
|
---|
| 79 | See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
|
---|
| 80 | examples for your environment.
|
---|
| 81 |
|
---|
| 82 | ## Contributors
|
---|
| 83 |
|
---|
| 84 | See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).
|
---|
| 85 |
|
---|
| 86 | ## License
|
---|
| 87 |
|
---|
| 88 | [Template:CSSData] by Mozilla Contributors is licensed under [CC-BY-SA 2.5].
|
---|
| 89 |
|
---|
| 90 | [template:cssdata]: https://developer.mozilla.org/en-US/docs/Template:CSSData
|
---|
| 91 | [cc-by-sa 2.5]: http://creativecommons.org/licenses/by-sa/2.5/
|
---|
| 92 |
|
---|
| 93 | MIT © [Ben Briggs](http://beneb.info)
|
---|
| 94 |
|
---|
| 95 | [postcss]: https://github.com/postcss/postcss
|
---|