Script of the Day: Conditionizr

A JavaScript library for conditionally loading JS and CSS assets

Inspired by the Modernizr library, Conditionizr provides a way to detect browser Retina and pixel ratio, and supply the appropriate JS and CSS assets.

Developed in a collaboration between Todd Motto and Mark Goodyear, Conditionzr was originally created to work on top of jQuery. But since v2, the library has been redone to work with Vanilla JS, achieving a 50% increase in speed as well.

If the scope of Conditionizr eludes you, the library works in a very simple and smart way. It will detect the user's browser features and depending on its supported properties, it will serve the appropriate CSS stylesheets and JavaScript files.

Using Conditionzr, developers will always be able to deliver the site version most appropriate for the user's devices, serving Retina or other 2x images to appropriate devices, while also sending polyfills and other shims to visitors with older browser versions.

Conditionizr is perfect for implementing a “progressive enhancement” on Web pages, and it helps developers acquire safe and recommended working habits by using it alongside Modernizr in their apps.

For Git freaks, Conditionizr development is also handled via GitHub as well.

Download Conditionizr from our Scripts section here.

Hot right now  ·  Latest news