@@ -553,11 +553,13 @@ Insert styles at top of `head` tag:
553553
554554** insert-function.js**
555555
556+ <!-- eslint-disable -->
557+
556558``` js
557559function insertAtTop (element ) {
558- var parent = document .querySelector (" head" );
559- // eslint-disable-next-line no-underscore-dangle
560- var lastInsertedElement = window ._lastElementInsertedByStyleLoader ;
560+ const parent = document .querySelector (" head" );
561+
562+ const lastInsertedElement = window ._lastElementInsertedByStyleLoader ;
561563
562564 if (! lastInsertedElement) {
563565 parent .insertBefore (element, parent .firstChild );
@@ -567,7 +569,6 @@ function insertAtTop(element) {
567569 parent .appendChild (element);
568570 }
569571
570- // eslint-disable-next-line no-underscore-dangle
571572 window ._lastElementInsertedByStyleLoader = element;
572573}
573574
@@ -603,7 +604,7 @@ You can pass any parameters to `style.use(options)` and this value will be passe
603604
604605``` js
605606function insertIntoTarget (element , options ) {
606- var parent = options .target || document .head ;
607+ const parent = options .target || document .head ;
607608
608609 parent .appendChild (element);
609610}
@@ -844,6 +845,7 @@ For `development` mode (including `webpack-dev-server`), you can use `style-load
844845
845846``` js
846847const MiniCssExtractPlugin = require (" mini-css-extract-plugin" );
848+
847849const devMode = process .env .NODE_ENV !== " production" ;
848850
849851module .exports = {
@@ -860,7 +862,7 @@ module.exports = {
860862 },
861863 ],
862864 },
863- plugins: []. concat ( devMode ? [] : [new MiniCssExtractPlugin ()]),
865+ plugins: [devMode ? [] : [new MiniCssExtractPlugin ()]]. flat ( ),
864866};
865867```
866868
@@ -891,7 +893,7 @@ module.exports = {
891893** index.js**
892894
893895``` js
894- import { fooBaz , bar , "my -class " as myClass } from " ./styles.css" ;
896+ import { bar , fooBaz , "my -class " as myClass } from " ./styles.css" ;
895897
896898console .log (fooBaz, bar, myClass);
897899```
@@ -1071,10 +1073,12 @@ Insert styles at top of `head` tag.
10711073
10721074** insert-function.js**
10731075
1076+ <!-- eslint-disable -->
1077+
10741078``` js
10751079function insertAtTop (element ) {
1076- var parent = document .querySelector (" head" );
1077- var lastInsertedElement = window ._lastElementInsertedByStyleLoader ;
1080+ const parent = document .querySelector (" head" );
1081+ const lastInsertedElement = window ._lastElementInsertedByStyleLoader ;
10781082
10791083 if (! lastInsertedElement) {
10801084 parent .insertBefore (element, parent .firstChild );
@@ -1119,6 +1123,8 @@ Inserts styles before `#id` element.
11191123
11201124** insert-function.js**
11211125
1126+ <!-- eslint-disable -->
1127+
11221128``` js
11231129function insertBeforeAt (element ) {
11241130 const parent = document .querySelector (" head" );
@@ -1171,7 +1177,7 @@ You can define custom target for your styles when using the `lazyStyleTag` type.
11711177
11721178``` js
11731179function insertIntoTarget (element , options ) {
1174- var parent = options .target || document .head ;
1180+ const parent = options .target || document .head ;
11751181
11761182 parent .appendChild (element);
11771183}
0 commit comments