项目原始demo,不改动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. # [postcss][postcss]-discard-unused [![Build Status](https://travis-ci.org/ben-eb/postcss-discard-unused.svg?branch=master)][ci] [![NPM version](https://badge.fury.io/js/postcss-discard-unused.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/postcss-discard-unused.svg)][deps]
  2. > Discard unused counter styles, keyframes and fonts.
  3. ## Install
  4. With [npm](https://npmjs.org/package/postcss-discard-unused) do:
  5. ```
  6. npm install postcss-discard-unused --save
  7. ```
  8. ## Example
  9. This module will discard unused at rules in your CSS file, if it cannot find
  10. any selectors that make use of them. It works on `@counter-style`, `@keyframes`
  11. and `@font-face`.
  12. ### Input
  13. ```css
  14. @counter-style custom {
  15. system: extends decimal;
  16. suffix: "> "
  17. }
  18. @counter-style custom2 {
  19. system: extends decimal;
  20. suffix: "| "
  21. }
  22. a {
  23. list-style: custom
  24. }
  25. ```
  26. ### Output
  27. ```css
  28. @counter-style custom {
  29. system: extends decimal;
  30. suffix: "> "
  31. }
  32. a {
  33. list-style: custom
  34. }
  35. ```
  36. Note that this plugin is not responsible for normalising font families, as it
  37. makes the assumption that you will write your font names consistently, such that
  38. it considers these two declarations differently:
  39. ```css
  40. h1 {
  41. font-family: "Helvetica Neue"
  42. }
  43. h2 {
  44. font-family: Helvetica Neue
  45. }
  46. ```
  47. However, you can mitigate this by including [postcss-minify-font-values][mfv]
  48. *before* this plugin, which will take care of normalising quotes, and
  49. deduplicating. For more examples, see the [tests](test.js).
  50. ## Usage
  51. See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
  52. examples for your environment.
  53. ## API
  54. ### discardUnused([options])
  55. #### options
  56. ##### fontFace
  57. Type: `boolean`
  58. Default: `true`
  59. Pass `false` to disable discarding unused font face rules.
  60. ##### counterStyle
  61. Type: `boolean`
  62. Default: `true`
  63. Pass `false` to disable discarding unused counter style rules.
  64. ##### keyframes
  65. Type: `boolean`
  66. Default: `true`
  67. Pass `false` to disable discarding unused keyframe rules.
  68. ##### namespace
  69. Type: `boolean`
  70. Default: `true`
  71. Pass `false` to disable discarding unused namespace rules.
  72. ## Contributors
  73. Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
  74. <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
  75. | [<img src="https://avatars.githubusercontent.com/u/1282980?v=3" width="100px;"/><br /><sub>Ben Briggs</sub>](http://beneb.info)<br />[💻](https://github.com/ben-eb/postcss-discard-unused/commits?author=ben-eb) [📖](https://github.com/ben-eb/postcss-discard-unused/commits?author=ben-eb) 👀 [⚠️](https://github.com/ben-eb/postcss-discard-unused/commits?author=ben-eb) | [<img src="https://avatars.githubusercontent.com/u/5635476?v=3" width="100px;"/><br /><sub>Bogdan Chadkin</sub>](https://github.com/TrySound)<br />[💻](https://github.com/ben-eb/postcss-discard-unused/commits?author=TrySound) [📖](https://github.com/ben-eb/postcss-discard-unused/commits?author=TrySound) 👀 [⚠️](https://github.com/ben-eb/postcss-discard-unused/commits?author=TrySound) | [<img src="https://avatars.githubusercontent.com/u/770675?v=3" width="100px;"/><br /><sub>Paweł Lesiecki</sub>](https://github.com/plesiecki)<br />[💻](https://github.com/ben-eb/postcss-discard-unused/commits?author=plesiecki) [⚠️](https://github.com/ben-eb/postcss-discard-unused/commits?author=plesiecki) | [<img src="https://avatars.githubusercontent.com/u/197928?v=3" width="100px;"/><br /><sub>Thomas McDonald</sub>](https://github.com/thomas-mcdonald)<br />[💻](https://github.com/ben-eb/postcss-discard-unused/commits?author=thomas-mcdonald) [⚠️](https://github.com/ben-eb/postcss-discard-unused/commits?author=thomas-mcdonald) |
  76. | :---: | :---: | :---: | :---: |
  77. <!-- ALL-CONTRIBUTORS-LIST:END -->
  78. This project follows the [all-contributors] specification. Contributions of
  79. any kind welcome!
  80. ## License
  81. MIT © [Ben Briggs](http://beneb.info)
  82. [all-contributors]: https://github.com/kentcdodds/all-contributors
  83. [ci]: https://travis-ci.org/ben-eb/postcss-discard-unused
  84. [deps]: https://gemnasium.com/ben-eb/postcss-discard-unused
  85. [npm]: http://badge.fury.io/js/postcss-discard-unused
  86. [postcss]: https://github.com/postcss/postcss
  87. [mfv]: https://github.com/trysound/postcss-minify-font-values