Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

stylehacks

Package Overview
Dependencies
2
Maintainers
7
Versions
39
Issues
File Explorer

Advanced tools

stylehacks

Detect/remove browser hacks from CSS files.

    5.1.1latest

Version published
Maintainers
7
Weekly downloads
9,847,573
decreased by-12.93%

Weekly downloads

Changelog

Source

v5.1.14

Bug Fixes

  • fix: update autoprefixer and browserslist
  • fix(postcss-reduce-initial): improve initial properties data

Readme

Source

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.

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

Keywords

FAQs

What is stylehacks?

Detect/remove browser hacks from CSS files.

Is stylehacks popular?

The npm package stylehacks receives a total of 7,931,321 weekly downloads. As such, stylehacks popularity was classified as popular.

Is stylehacks well maintained?

We found that stylehacks demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 7 open source maintainers collaborating on the project.

Last updated on 28 Oct 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc