postcss-icss-selectors
PostCSS plugin for css modules to local-scope classes and ids
Last updated 7 years ago by trysound .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install postcss-icss-selectors 
SYNC missed versions from official npm registry.

postcss-icss-selectors Build Status

PostCSS plugin for css modules to local-scope classes and ids

Usage

postcss([ require('postcss-icss-selectors')(options) ])

See PostCSS docs for examples for your environment.

Options

mode

local by default or global

In local mode

.foo { ... } /* => */ .file__foo---h63h { ... }

.foo .bar { ... } /* => */ .file__foo----h63h .file__bar----h63h { ... }

/* Shorthand global selector */

:global .foo .bar { ... } /* => */ .foo .bar { ... }

.foo :global .bar { ... } /* => */ .file__foo----h63h .bar { ... }

/* Targeted global selector */

:global(.foo) .bar { ... } /* => */ .foo .file__bar----h63h { ... }

.foo:global(.bar) { ... } /* => */ .file__foo----h63h.bar { ... }

.foo :global(.bar) .baz { ... } /* => */ .file__foo----h63h .bar .file__baz----h63h { ... }

.foo:global(.bar) .baz { ... } /* => */ .file__foo----h63h.bar .file__baz----h63h { ... }

In global mode

.foo { ... } /* => */ .foo { ... }

.foo .bar { ... } /* => */ .foo .bar { ... }

/* Shorthand local selector */

:local .foo :global .bar { ... } /* => */ .file__foo----h63h .bar { ... }

.foo :local .bar { ... } /* => */ .foo .file__foo----h63h { ... }

/* Targeted local selector */

:local(.foo) .bar { ... } /* => */ .file__foo----h63h .bar { ... }

.foo:local(.bar) { ... } /* => */ .foo.file__bar----h63h { ... }

generateScopeName(localName, filepath, css)

Converts every new local name in #id or .class defintion to global alias. By default returns [name]__[local]---[hash:base64:5].

Messages

postcss-icss-selectors passes result.messages for each local-scoped class or id

{
  plugin: 'postcss-icss-selectors',
  type: 'icss-scoped',
  name: string, // local-scoped identifier
  value: string // generated global identifier
}

License

MIT © Mark Dalgleish and Bogdan Chadkin, 2015

Current Tags

  • 2.0.3                                ...           latest (7 years ago)

4 Versions

  • 2.0.3                                ...           7 years ago
  • 2.0.2                                ...           7 years ago
  • 2.0.1                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (9)

Copyright 2013 - present © cnpmjs.org | Home |