Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yenshih committed Aug 11, 2018
1 parent ce59e3b commit dd9da03
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Expand Up @@ -13,7 +13,7 @@
>
</a>
<h1>Style Resources Loader</h1>
<p>CSS preprocessor resources loader for webpack.</p>
<p>CSS processor resources loader for webpack.</p>
</div>


Expand All @@ -25,7 +25,7 @@ npm i style-resources-loader -D

<h2 align="center">Usage</h2>

This loader is a CSS preprocessor resources loader for webpack, which injects your style resources (e.g. `variables / mixins`) into multiple imported `sass / scss / less / stylus` modules.
This loader is a CSS processor resources loader for webpack, which injects your style resources (e.g. `variables / mixins`) into multiple imported `css / sass / scss / less / stylus` modules.

It's mainly used to
- share your `variables / mixins / functions` across all style files, so you don't need to `@import` them manually.
Expand Down Expand Up @@ -138,12 +138,16 @@ For example, `path.resolve(__dirname, './styles/*/*.less')` would include all `l
|-- reset.less
```

Only supports `.css` `.sass` `.scss` `.less` `.styl` as resources file extensions.

### `injector`

An optional function which controls the resources injection precisely. It also supports `prepend` and `append` for convenience.

It defaults to `prepend` (equivalent to `(source, resources) => resources.map(({ content }) => content).join('') + source` internally), which means the loader prepends all resources to source file.

It could be asynchronous. You could use `async / await` syntax in your own injector function.

An injector function receives two parameters:

|Name|Type|Default|Description|
Expand Down

0 comments on commit dd9da03

Please sign in to comment.