3.3.0 • Published 8 years ago

sanitize.styl v3.3.0

Weekly downloads
8
License
MIT
Repository
github
Last release
8 years ago

sanitize.styl

add sanitize() mixin using sanitize.css/lib/sanitize.styl

Installation

npm install sanitize.styl --save

or, force latest sanitize.css installation using @newest.

npm install sanitize.styl@newest --save

Usage

Via CLI

// index.styl
@import 'sanitize.styl'

sanitize()
stylus --use sanitize.styl index.styl
# /* sanitize.css v3.3.0 | CC0 1.0 Public Domain | github.com/10up/sanitize.css */
# /*
#  * Normalization
#  */
# abbr[title] {
# ...

Via API

import stylus from 'stylus';
import sanitizeStyl from 'sanitize.styl';

stylus('sanitize()')
.use(sanitizeStyl())
.import('sanitize.styl')
.render((err, css) => {
  if (err) {
    throw err;
  }
  console.log(css);
  //
  // /* sanitize.css v3.3.0 | CC0 1.0 Public Domain | github.com/10up/sanitize.css */
  // /*
  //  * Normalization
  //  */
  // abbr[title] {
  // ...
});

Mixins

sanitize()

expand the sanitize.css in the execute position.

In

@import 'sanitize.styl'
sanitize()

Out

/* sanitize.css v3.3.0 | CC0 1.0 Public Domain | github.com/10up/sanitize.css */
abbr[title] {
...

In

@import 'sanitize.styl'
#container
  sanitize()

Out

/* sanitize.css v3.3.0 | CC0 1.0 Public Domain | github.com/10up/sanitize.css */
#container abbr[title] {
...

Development

Requirement global

  • NodeJS v6.2.1
  • Npm v3.9.3 (or pnpm)
git clone https://github.com/59naga/sanitize.styl
cd sanitize.styl
npm install

npm test

License

MIT