Last week I scratched my own itch (again) and built a (offline!) command line tool for “CanIUse …” and MDN’s browser-compat-data.

~

Installation and UsageYou can install @bramus/caniuse-cli through NPM (or whatever package manager you are using).

npm i -g @bramus/caniuse-cli Once installed, you can call caniuse on the command line. The passed in argument is your search term.

caniuse viewport-units The package differs from other attempts at this by not only using caniuse-db but by also integrating @mdn/browser-compat-data. That means you can also query for things like the upcoming calc-size() or @property.

caniuse calc-size

caniuse @property Because both datasets are stored locally, @bramus/caniuse-cli requires no live internet connection once installed.

Furthermore it also collapses the releases in the output table, just like the “CanIUse …” website does it.

~

Source codeThe source code is available on GitHub. PRs very welcome as this was thrown together in a jiffy, hacking on the original by @dsenkus.

One area I am specifically looking help for, is a way to provide an auto-update mechanism for the datasets. I think I have a solution for this, but I’m sure it could be done better – especially because my approach is limited to Node’s npm only.

~

Spread the wordFeel free to repost one of the posts from social media to give them more reach, or link to this post from your own blog.

I scratched my own itch (again) and built a @caniuse CLI tool.

It differs from other attempts at this by also integrating @MozDevNet’s browser-compat-data + collapsing releases in the table (just like the website does).

⌨️npm i -g @bramus/caniuse-cli
🔗 https://t.co/Ocp3t9erEz pic.twitter.com/Ly6SPNkgKo

— Bramus (@bramus) September 9, 2024

~

🔥 Like what you see? Want to stay in the loop? Here's how:

  • Follow @bramus on Twitter
  • Follow @bramus on Mastodon
  • Follow @bramusblog on Twitter
  • Follow bram.us using RSS