source: trip-planner-front/node_modules/stylehacks/README.md@ e29cc2e

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

initial commit

  • Property mode set to 100644
File size: 1.7 KB
Line 
1# stylehacks
2
3> Detect/remove browser hacks from CSS files.
4
5
6## Install
7
8With [npm](https://npmjs.org/package/stylehacks) do:
9
10```
11npm install stylehacks --save
12```
13
14
15## Example
16
17In its default mode, stylehacks will remove hacks from your CSS file, based on
18the browsers that you wish to support.
19
20### Input
21
22```css
23h1 {
24 _color: white;
25 color: rgba(255, 255, 255, 0.5);
26}
27```
28
29### Output
30
31```css
32h1 {
33 color: rgba(255, 255, 255, 0.5);
34}
35```
36
37
38## API
39
40### `stylehacks.detect(node)`
41
42Type: `function`
43Returns: `boolean`
44
45This method will take any PostCSS *node*, run applicable plugins depending on
46its type, then will return a boolean depending on whether it found any of
47the supported hacks. For example, if the `decl` node found below is passed to
48the `detect` function, it will return `true`. But if the `rule` node is passed,
49it will return `false` instead.
50
51```css
52h1 { _color: red }
53```
54
55### `stylehacks.process(css, [options]).then(function(result) {})`
56
57#### options
58
59##### lint
60
61Type: `boolean`
62Default: `false`
63
64If lint mode is enabled, stylehacks will not remove hacks from the CSS; instead,
65it will add warnings to `Result#messages`.
66
67
68### `postcss([ stylehacks(opts) ])`
69
70stylehacks can also be consumed as a PostCSS plugin. See the
71[documentation](https://github.com/postcss/postcss#usage) for examples for
72your environment.
73
74
75## Related
76
77stylehacks works well with your existing PostCSS setup:
78
79* [stylelint] - Comprehensive & modern CSS linter, to ensure that your code
80 style rules are respected.
81
82
83## Contributing
84
85Pull requests are welcome. If you add functionality, then please add unit tests
86to cover it.
87
88
89## License
90
91MIT © [Ben Briggs](http://beneb.info)
92
93
94[stylelint]: https://github.com/stylelint/stylelint
Note: See TracBrowser for help on using the repository browser.