Skip to content

Commit 188ef9c

Browse files
committed
docs: add docs for insertInto option
1 parent b5c420a commit 188ef9c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,23 @@ If you'd like to extract the media queries from the extracted CSS (so mobile use
293293
</table>
294294

295295

296+
#### Determining Insertion Point for Async CSS Chunks
297+
298+
If you are extracting CSS into separate files and using Webpack Dynamic Imports, it is possible you will need to be able to configure the insertion point of your async CSS chunks in the document to preserve ordering for the CSS cascade. This is possible using the `insertInto` option, which takes a function that will be called to determine the parent node into which to insert the `<link>`` tag for the chunk CSs file
299+
300+
```javascript
301+
module.exports = {
302+
...
303+
plugins: [
304+
new MiniCssExtractPlugin({
305+
filename: "[name].css",
306+
insertInto: href => document.querySeletor('.async-styles-container'),
307+
})
308+
],
309+
...
310+
}
311+
```
312+
296313
## License
297314

298315
[MIT](./LICENSE)

0 commit comments

Comments
 (0)