Skip to content

Commit b19de0b

Browse files
committed
updating readme
1 parent 8ea4b6e commit b19de0b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
44
## API
55

6+
```js
7+
import Core from 'css-modules-loader-core'
8+
let core = new Core()
9+
```
10+
611
### core.load( sourceString , sourcePath , pathFetcher ) =><br>&nbsp;&nbsp;Promise({ injectableSource, exportTokens })
712

813
Processes the input CSS `sourceString`, looking for dependencies such as `@import` or `:import`. Any localisation will happen by prefixing a sanitised version of `sourcePath` When dependencies are found, it will ask the `pathFetcher` for each dependency, resolve & inline any imports, and return the following object:
@@ -12,22 +17,21 @@ Processes the input CSS `sourceString`, looking for dependencies such as `@impor
1217

1318
These should map nicely to what your build-tool-specific loader needs to do its job.
1419

15-
### core.plugins = pluginArray
20+
### new Core([plugins])
1621

1722
The default set of plugins is [[postcss-modules-local-by-default](https://github.com/css-modules/postcss-modules-local-by-default), [postcss-modules-extract-imports](https://github.com/css-modules/postcss-modules-extract-imports), [postcss-modules-scope](https://github.com/css-modules/postcss-modules-scope)] (i.e. the CSS Modules specification). This can override which PostCSS plugins you wish to execute, e.g.
1823

1924
```js
20-
import core from 'css-loader-core'
25+
import Core from 'css-loader-core'
2126
import autoprefixer from 'autoprefixer'
2227
import colorFunctions from 'postcss-color-function'
2328

2429
// Don't run local-by-default, but use colorFunctions
2530
// beforehand and autoprefixer afterwards:
26-
core.plugins = [
31+
let core = new Core([
2732
colorFunctions,
2833
core.plugins.extractImports,
2934
core.plugins.scope,
3035
autoprefixer("Last 2 Versions")
31-
]
36+
])
3237
```
33-

0 commit comments

Comments
 (0)