| | |
| | | |
| | | |Name|Type|Default|Description| |
| | | |:--:|:--:|:-----:|:----------| |
| | | |**[`patterns`](#patterns)**|`{string \| string[]}`|`/`|Path to the resources you would like to inject| |
| | | |**[`injector`](#injector)**|`{Function \| 'prepend' \| 'append'}`|`'prepend'`|Controls the resources injection precisely| |
| | | |**[`globOptions`](#globoptions)**|`{Object}`|`{}`|An options that can be passed to `glob(...)`| |
| | | |**[`resolveUrl`](#resolveurl)**|`{boolean}`|`true`|Enable/Disable `@import` url to be resolved| |
| | | |**[`patterns`](#patterns)**|`string \| string[]`|`/`|Path to the resources you would like to inject| |
| | | |**[`injector`](#injector)**|`Injector \| 'prepend' \| 'append'`|`'prepend'`|Controls the resources injection precisely| |
| | | |**[`globOptions`](#globoptions)**|`GlobOptions`|`{}`|An options that can be passed to `glob(...)`| |
| | | |**[`resolveUrl`](#resolveurl)**|`boolean`|`true`|Enable/Disable `@import` url to be resolved| |
| | | |
| | | See [the type definition file](https://github.com/yenshih/style-resources-loader/blob/master/src/types.ts) for more details. |
| | | |
| | |
| | | Furthermore, an injector function should match the following type signature: |
| | | |
| | | ```ts |
| | | (source: string, resources: StyleResource[]) => string | Promise<string> |
| | | type Injector = ( |
| | | this: LoaderContext, |
| | | source: string, |
| | | resources: StyleResource[], |
| | | ) => string | Promise<string> |
| | | ``` |
| | | |
| | | It receives two parameters: |
| | | |
| | | |Name|Type|Default|Description| |
| | | |:--:|:--:|:-----:|:----------| |
| | | |**`source`**|`{string}`|`/`|Content of the source file| |
| | | |**[`resources`](#resources)**|`{StyleResource[]}`|`/`|Resource descriptors| |
| | | |Name|Type|Description| |
| | | |:--:|:--:|:----------| |
| | | |**`source`**|`string`|Content of the source file| |
| | | |**[`resources`](#resources)**|`StyleResource[]`|Resource descriptors| |
| | | |
| | | It is called with `this` context pointing to the loader context. |
| | | |
| | | #### `resources` |
| | | |
| | | An array of resource descriptor, each contains `file` and `content` properties: |
| | | |
| | | |Name|Type|Default|Description| |
| | | |:--:|:--:|:-----:|:----------| |
| | | |**`file`**|`{string}`|`/`|Absolute path to the resource| |
| | | |**`content`**|`{string}`|`/`|Content of the resource file| |
| | | |Name|Type|Description| |
| | | |:--:|:--:|:----------| |
| | | |**`file`**|`string`|Absolute path to the resource| |
| | | |**`content`**|`string`|Content of the resource file| |
| | | |
| | | It can be asynchronous. You could use `async / await` syntax in your own injector function or just return a promise. |
| | | |