source: trip-planner-front/node_modules/postcss-discard-comments/README.md@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.3 KB
Line 
1# [postcss][postcss]-discard-comments
2
3> Discard comments in your CSS files with PostCSS.
4
5
6## Install
7
8With [npm](https://npmjs.org/package/postcss-discard-comments) do:
9
10```
11npm install postcss-discard-comments --save
12```
13
14
15## Example
16
17### Input
18
19```css
20h1/* heading */{
21 margin: 0 auto
22}
23```
24
25### Output
26
27```css
28h1 {
29 margin: 0 auto
30}
31```
32
33This module discards comments from your CSS files; by default, it will remove
34all regular comments (`/* comment */`) and preserve comments marked as important
35(`/*! important */`).
36
37Note that this module does not handle source map comments because they are not
38available to it; PostCSS handles this internally, so if they are removed then
39you will have to [configure source maps in PostCSS][maps].
40
41[maps]: https://github.com/postcss/postcss/blob/master/docs/source-maps.md
42
43
44## API
45
46### comments([options])
47
48#### options
49
50##### remove(function)
51
52Type: `function`
53Return: `boolean`
54Variable: `comment` contains a comment without `/**/`
55
56For each comment, return true to remove, or false to keep the comment.
57
58```js
59function(comment) {}
60```
61
62```js
63var css = '/* headings *//*@ h1 */h1{margin:0 auto}/*@ h2 */h2{color:red}';
64console.log(postcss(comments({
65 remove: function(comment) { return comment[0] == "@"; }
66})).process(css).css);
67//=> /* headings */h1{margin:0 auto}h2{color:red}
68```
69**NOTE:** If you use the `remove` function other options will not be available.
70
71##### removeAll
72
73Type: `boolean`
74Default: `false`
75
76Remove all comments marked as important.
77
78```js
79var css = '/*! heading */h1{margin:0 auto}/*! heading 2 */h2{color:red}';
80console.log(postcss(comments({removeAll: true})).process(css).css);
81//=> h1{margin:0 auto}h2{color:red}
82```
83
84##### removeAllButFirst
85
86Type: `boolean`
87Default: `false`
88
89Remove all comments marked as important, but the first one.
90
91```js
92var css = '/*! heading */h1{margin:0 auto}/*! heading 2 */h2{color:red}';
93console.log(postcss(comments({removeAllButFirst: true})).process(css).css);
94//=> /*! heading */h1{margin:0 auto}h2{color:red}
95```
96
97
98## Usage
99
100See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
101examples for your environment.
102
103
104## Contributors
105
106See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).
107
108
109## License
110
111MIT © [Ben Briggs](http://beneb.info)
112
113
114[postcss]: https://github.com/postcss/postcss
Note: See TracBrowser for help on using the repository browser.