CanIUse Command Line

By  on  

Every front-end developer should be well acquainted with CanIUse, the website that lets you view browser support for browser features.  When people criticize my blog posts for not detailing browser support for features within the post, I tell them to check CanIUse:  always up to date, unlike posts on any blog.  While I know to use the CanIUse website, I recently found out that Sam Gentle has an accompanying Node.js CanIUse module for looking up browser support.

To install the utility, use a typical npm install command:

# Install globally for less hassle
npm install -g caniuse-cmd

With the caniuse command available, you can look up feature support from the command line:

CanIUse

CanIUse

The display of results is pretty and it provides a listing of different matching features if the lookup is vague.  And because we can get this information in an automated way, you can probably write a decent scraper with cURL and other tools.

Recent Features

  • By
    Create a CSS Flipping Animation

    CSS animations are a lot of fun; the beauty of them is that through many simple properties, you can create anything from an elegant fade in to a WTF-Pixar-would-be-proud effect. One CSS effect somewhere in between is the CSS flip effect, whereby there's...

  • By
    Camera and Video Control with HTML5

    Client-side APIs on mobile and desktop devices are quickly providing the same APIs.  Of course our mobile devices got access to some of these APIs first, but those APIs are slowly making their way to the desktop.  One of those APIs is the getUserMedia API...

Incredible Demos

  • By
    Xbox Live Gamer API

    My sharpshooter status aside, I've always been surprised upset that Microsoft has never provided an API for the vast amount of information about users, the games they play, and statistics within the games. Namely, I'd like to publicly shame every n00b I've baptized with my...

  • By
    Facebook-Style Modal Box Using MooTools

    In my oh-so-humble opinion, Facebook's Modal box is the best modal box around. It's lightweight, subtle, and very stylish. I've taken Facebook's imagery and CSS and combined it with MooTools' awesome functionality to duplicate the effect. The Imagery Facebook uses a funky sprite for their modal...

Discussion

  1. Steve

    I need to get this hooked up to be an email responder bot! “Hey Steve does ${browserX} support ${featureY}?” => auto respond ;-)

  2. Dominik

    How about just adding canIuse as a search engine to your browser, like so http://caniuse.com/#search=%s?
    Simply typing “c webp” into my browser gives me even nicer formatted results.

  3. Sadly the output is not very useful for automated processing. It would’ve been nice if this could be implemented in a gulp-task, scanning CSS for a defined set of supported browsers, and if a css-declaration wasn’t supported it would throw an error.
    But as your example of ‘transform’ shows, it returns things like JPEG2000, so output parsing is required and tedious. Plus it seems that there is no option to print a simple boolean instead of fancy ticks and crosses.

  4. Definitely an interesting article about this new npm tool, useful for those who like command line better then gui.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!