stylehacks
Detect/remove browser hacks from CSS files.
Last updated a year ago by ludovicofischer .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install stylehacks 
SYNC missed versions from official npm registry.

stylehacks

Detect/remove browser hacks from CSS files.

Install

With npm do:

npm install stylehacks --save

Example

In its default mode, stylehacks will remove hacks from your CSS file, based on the browsers that you wish to support.

Input

h1 {
    _color: white;
    color: rgba(255, 255, 255, 0.5);
}

Output

h1 {
    color: rgba(255, 255, 255, 0.5);
}

API

stylehacks.detect(node)

Type: function
Returns: boolean

This method will take any PostCSS node, run applicable plugins depending on its type, then will return a boolean depending on whether it found any of the supported hacks. For example, if the decl node found below is passed to the detect function, it will return true. But if the rule node is passed, it will return false instead.

h1 { _color: red }

postcss([ stylehacks(opts) ])

stylehacks can also be consumed as a PostCSS plugin. See the documentation for examples for your environment.

options

lint

Type: boolean
Default: false

If lint mode is enabled, stylehacks will not remove hacks from the CSS; instead, it will add warnings to Result#messages.

Related

stylehacks works well with your existing PostCSS setup:

  • stylelint - Comprehensive & modern CSS linter, to ensure that your code style rules are respected.

Contributing

Pull requests are welcome. If you add functionality, then please add unit tests to cover it.

License

MIT © Ben Briggs

Current Tags

  • 7.0.4                                ...           latest (2 months ago)
  • 5.0.0-rc.2                                ...           next (4 years ago)
  • 4.0.0-nightly.2020.2.6                                ...           nightly (4 years ago)

50 Versions

  • 7.0.4                                ...           2 months ago
  • 7.0.3                                ...           3 months ago
  • 7.0.2                                ...           5 months ago
  • 7.0.1                                ...           5 months ago
  • 7.0.0                                ...           7 months ago
  • 6.1.1                                ...           8 months ago
  • 6.1.0                                ...           8 months ago
  • 6.0.3                                ...           9 months ago
  • 6.0.2                                ...           10 months ago
  • 6.0.1                                ...           a year ago
  • 6.0.0                                ...           2 years ago
  • 5.1.1                                ...           2 years ago
  • 5.1.0                                ...           3 years ago
  • 5.0.3                                ...           3 years ago
  • 5.0.2                                ...           3 years ago
  • 5.0.1                                ...           3 years ago
  • 5.0.0                                ...           4 years ago
  • 5.0.0-rc.2                                ...           4 years ago
  • 5.0.0-rc.1                                ...           4 years ago
  • 5.0.0-rc.0                                ...           4 years ago
  • 4.0.0-nightly.2020.2.6                                ...           4 years ago
  • 4.0.0-nightly.2020.1.11                                ...           4 years ago
  • 4.0.0-nightly.2020.1.9                                ...           4 years ago
  • 4.0.0-nightly.2020.10.20                                ...           4 years ago
  • 4.0.0-nightly.2020.9.9                                ...           4 years ago
  • 4.0.0-nightly.2020.9.3                                ...           4 years ago
  • 4.0.0-nightly.2020.9.1                                ...           4 years ago
  • 4.0.0-nightly.2020.8.29                                ...           4 years ago
  • 4.0.0-nightly.2020.8.25                                ...           4 years ago
  • 4.0.0-nightly.2020.8.24                                ...           4 years ago
  • 4.0.0-nightly.2020.8.17                                ...           4 years ago
  • 4.0.0-nightly.2020.8.10                                ...           4 years ago
  • 4.0.0-nightly.2020.8.4                                ...           4 years ago
  • 4.0.0-nightly.2020.8.1                                ...           4 years ago
  • 4.0.0-nightly.2020.7.31                                ...           4 years ago
  • 4.0.0-nightly.2020.7.25                                ...           4 years ago
  • 4.0.0-nightly.2020.7.24                                ...           4 years ago
  • 4.0.3                                ...           6 years ago
  • 4.0.2                                ...           6 years ago
  • 4.0.1                                ...           6 years ago
  • 4.0.0                                ...           6 years ago
  • 4.0.0-rc.2                                ...           7 years ago
  • 4.0.0-rc.0                                ...           7 years ago
  • 2.3.2                                ...           8 years ago
  • 2.3.1                                ...           9 years ago
  • 2.3.0                                ...           9 years ago
  • 2.2.0                                ...           9 years ago
  • 2.1.0                                ...           9 years ago
  • 2.0.0                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Downloads
Total 2
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE