This content originally appeared on Bram.us and was authored by Bramus!
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 Usage
You 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 code
The 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 word
Feel 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:
This content originally appeared on Bram.us and was authored by Bramus!
Bramus! | Sciencx (2024-09-14T21:27:40+00:00) Introducing @bramus/caniuse-cli, a CLI tool for “Can I Use …”. Retrieved from https://www.scien.cx/2024/09/14/introducing-bramus-caniuse-cli-a-cli-tool-for-can-i-use/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.