modernizr-stylus

0.0.2 • Public • Published

Modernizr-Stylus

npm tests

Modernizr-Stylus is a handy utility plugin for the Stylus CSS preprocessor that makes feature detection with Modernizr.js a lot easier.

It turns this...:

.test
  +yep(csstransforms, csstransforms3d)
    transformtranslate3d(100px00)
  +nope(csstransforms, csstransforms3d)
    left100px

...into this:

.csstransforms.csstransforms3d .test
  transformtranslate3d(100px00)
.no-js .test,
.no-csstransforms .test,
.no-csstransforms3d .test
  left100px

Installation

You can install Modernizr-Stylus through NPM:

$ npm install modernizr-stylus

Usage

Modernizr-Stylus is a Stylus plugin, and can be integrated in any way that Stylus plugins normally are. If you are curious how to use Stylus plugins, feel free to check out this guide.

By default, Modernizr-Stylus' mixins will be included automatically into all parsed stylesheets when included as above. If you'd like to import Modernizr-Stylus manually in Stylus when you want to use it, you can pass { implicit: false } to the Modernizr-Stylus call:

modernizr({ implicit: false })

If you do it this way, you'll need to @import Modernizr-Stylus manually wherever you'd like access to the mixins:

@import 'modernizr-stylus'
 
.test.test2
  +yep(boxshadow)
    box-shadow0 0 3px #000;
 
...etc...

Miscellaneous

Credits

Daniel Guillan - initial idea / scss mixins

Package Sidebar

Install

npm i modernizr-stylus

Weekly Downloads

3

Version

0.0.2

License

none

Last publish

Collaborators

  • declandewet