Skip to content

Commit f7848d0

Browse files
committed
Refactor docs
1 parent a17976a commit f7848d0

File tree

2 files changed

+49
-38
lines changed

2 files changed

+49
-38
lines changed

README.md

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,76 @@
1-
[![Build Status][ci-img]][ci] [![codecov][codecov-img]][codecov] [![npm][npm-img]][npm]
1+
# postcss-icss-selectors [![Build Status][travis-img]][travis]
22

3-
# CSS Modules: Local by Default
3+
[PostCSS]: https://github.com/postcss/postcss
4+
[travis-img]: https://travis-ci.org/css-modules/postcss-icss-selectors.svg
5+
[travis]: https://travis-ci.org/css-modules/postcss-icss-selectors
46

5-
Transformation examples:
7+
PostCSS plugin for css modules to to local-scope classes and ids
8+
9+
## Usage
10+
11+
```js
12+
postcss([ require('postcss-icss-selectors')(options) ])
13+
```
14+
15+
See [PostCSS] docs for examples for your environment.
16+
17+
### Options
18+
19+
#### mode
20+
21+
`local` by default or `global`
22+
23+
In local mode
624

725
```css
8-
.foo { ... } /* => */ :local(.foo) { ... }
26+
.foo { ... } /* => */ .file__foo---h63h { ... }
927

10-
.foo .bar { ... } /* => */ :local(.foo) :local(.bar) { ... }
28+
.foo .bar { ... } /* => */ .file__foo----h63h .file__bar----h63h { ... }
1129

1230
/* Shorthand global selector */
1331

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

16-
.foo :global .bar { ... } /* => */ :local(.foo) .bar { ... }
34+
.foo :global .bar { ... } /* => */ .file__foo----h63h .bar { ... }
1735

1836
/* Targeted global selector */
1937

20-
:global(.foo) .bar { ... } /* => */ .foo :local(.bar) { ... }
38+
:global(.foo) .bar { ... } /* => */ .foo .file__bar----h63h { ... }
2139

22-
.foo:global(.bar) { ... } /* => */ :local(.foo).bar { ... }
40+
.foo:global(.bar) { ... } /* => */ .file__foo----h63h.bar { ... }
2341

24-
.foo :global(.bar) .baz { ... } /* => */ :local(.foo) .bar :local(.baz) { ... }
42+
.foo :global(.bar) .baz { ... } /* => */ .file__foo----h63h .bar .file__baz----h63h { ... }
2543

26-
.foo:global(.bar) .baz { ... } /* => */ :local(.foo).bar :local(.baz) { ... }
44+
.foo:global(.bar) .baz { ... } /* => */ .file__foo----h63h.bar .file__baz----h63h { ... }
2745
```
2846

29-
## Building
47+
In global mode
3048

31-
```bash
32-
$ npm install
33-
$ npm test
34-
```
49+
```css
50+
.foo { ... } /* => */ .foo { ... }
3551

36-
- Build: [![Build Status][ci-img]][ci]
37-
- Lines: [![coveralls][coveralls-img]][coveralls]
38-
- Statements: [![codecov][codecov-img]][codecov]
52+
.foo .bar { ... } /* => */ .foo .bar { ... }
3953

40-
## Development
54+
/* Shorthand local selector */
4155

42-
```bash
43-
$ npm run autotest
44-
```
56+
:local .foo :global .bar { ... } /* => */ .file__foo----h63h .bar { ... }
4557

46-
## License
58+
.foo :local .bar { ... } /* => */ .foo .file__foo----h63h { ... }
4759

48-
MIT
60+
/* Targeted local selector */
4961

50-
## With thanks
62+
:local(.foo) .bar { ... } /* => */ .file__foo----h63h .bar { ... }
5163

52-
- [Tobias Koppers](https://github.com/sokra)
53-
- [Glen Maddern](https://github.com/geelen)
64+
.foo:local(.bar) { ... } /* => */ .foo.file__bar----h63h { ... }
65+
66+
```
5467

55-
---
56-
Mark Dalgleish, 2015.
68+
#### generateScopeName(localName, filepath, css)
69+
70+
Converts every new local name in #id or .class defintion to global alias.
71+
By default returns `[name]__[local]---[hash:base64:5]`.
72+
73+
74+
## License
5775

58-
[ci-img]: https://img.shields.io/travis/css-modules/postcss-modules-local-by-default/master.svg?style=flat-square
59-
[ci]: https://travis-ci.org/css-modules/postcss-modules-local-by-default
60-
[npm-img]: https://img.shields.io/npm/v/postcss-modules-local-by-default.svg?style=flat-square
61-
[npm]: https://www.npmjs.com/package/postcss-modules-local-by-default
62-
[coveralls-img]: https://img.shields.io/coveralls/css-modules/postcss-modules-local-by-default/master.svg?style=flat-square
63-
[coveralls]: https://coveralls.io/r/css-modules/postcss-modules-local-by-default?branch=master
64-
[codecov-img]: https://img.shields.io/codecov/c/github/css-modules/postcss-modules-local-by-default/master.svg?style=flat-square
65-
[codecov]: https://codecov.io/github/css-modules/postcss-modules-local-by-default?branch=master
76+
MIT © Mark Dalgleish and Bogdan Chadkin, 2015

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
]
4848
]
4949
},
50-
"author": "Mark Dalgleish",
50+
"author": "Mark Dalgleish and Bogdan Chadkin",
5151
"license": "MIT",
5252
"repository": {
5353
"type": "git",

0 commit comments

Comments
 (0)