{"_id":"7-style-loader","_rev":"1-e56bac30502baf940434ae03adbbb7d6","name":"7-style-loader","dist-tags":{"latest":"1.1.3"},"versions":{"1.1.3":{"name":"7-style-loader","version":"1.1.3","description":"style loader module for webpack","license":"MIT","repository":{"type":"git","url":"git+https://github.com/webpack-contrib/style-loader.git"},"author":{"name":"Tobias Koppers @sokra"},"homepage":"https://github.com/webpack-contrib/style-loader","bugs":{"url":"https://github.com/webpack-contrib/style-loader/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/webpack"},"main":"dist/cjs.js","engines":{"node":">= 8.9.0"},"scripts":{"start":"npm run build -- -w","clean":"del-cli dist","validate:runtime":"es-check es3 \"dist/runtime/**/*.js\"","prebuild":"npm run clean","build":"cross-env NODE_ENV=production babel src -d dist --copy-files","postbuild":"npm run validate:runtime","commitlint":"commitlint --from=master","security":"npm audit","lint:prettier":"prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different","lint:js":"eslint --cache .","lint":"npm-run-all -l -p \"lint:**\"","test:only":"cross-env NODE_ENV=test jest","test:watch":"npm run test:only -- --watch","test:coverage":"npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage","test:manual":"npm run build && webpack-dev-server test/manual/src/index.js --open --config test/manual/webpack.config.js","pretest":"npm run lint","test":"npm run test:coverage","prepare":"npm run build","release":"standard-version","defaults":"webpack-defaults"},"peerDependencies":{"webpack":"^4.0.0 || ^5.0.0"},"dependencies":{"loader-utils":"^1.2.3","schema-utils":"^2.6.4"},"devDependencies":{"@babel/cli":"^7.8.3","@babel/core":"^7.8.3","@babel/preset-env":"^7.8.3","@commitlint/cli":"^8.3.5","@commitlint/config-conventional":"^8.3.4","@webpack-contrib/defaults":"^6.3.0","@webpack-contrib/eslint-config-webpack":"^3.0.0","babel-jest":"^24.9.0","commitlint-azure-pipelines-cli":"^1.0.3","cross-env":"^6.0.3","css-loader":"^3.4.2","del":"^5.1.0","del-cli":"^3.0.0","es-check":"^5.1.0","eslint":"^6.8.0","eslint-config-prettier":"^6.9.0","eslint-plugin-import":"^2.20.0","file-loader":"^5.0.2","husky":"^3.1.0","jest":"^24.9.0","jest-junit":"^10.0.0","jsdom":"^15.2.1","lint-staged":"^9.5.0","memfs":"^3.0.4","npm-run-all":"^4.1.5","prettier":"^1.19.1","sass":"^1.24.5","sass-loader":"^8.0.2","semver":"^7.1.1","standard-version":"^7.0.1","webpack":"^4.41.5","webpack-cli":"^3.3.10","webpack-dev-server":"^3.10.1"},"keywords":["webpack"],"gitHead":"a003f056e6cb4e2895e1bf07cf1169cf198f2481","_id":"7-style-loader@1.1.3","_nodeVersion":"12.10.0","_npmVersion":"6.10.3","dist":{"integrity":"sha512-T4lgRiPUmUiE7gdbyHtin4wrIq6syPtF8wGSpHernI+5N/VZCppjXd9Pjs2WQNCVGU/v6k6YTnAaB7RUcXJG/A==","shasum":"9b6c6cd97aa6a84670f400c90b6239f3a81428d7","tarball":"https://registry.npmjs.org/7-style-loader/-/7-style-loader-1.1.3.tgz","fileCount":10,"unpackedSize":54066,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeahOZCRA9TVsSAnZWagAAE9cQAKLeoWmCuHluscoXxNtU\nzv7KTdLb/w83Im8RVKD/z2pbD7jGObbO9GLtHXFZEmOiovfVMpN8+Ay3UbJD\nR/m725QYOKdrDmnc5GRMNQBaUrqKDKrfJIoJQAIMP63xaNcDuUrXClBpRyuB\no8YsTbfi/VziPZByZqWgTdle3eL32CeyXnrcFLbJdKxLCTztQ9Oj2KjqHt2S\nyGV96wmMulgxq+Mifz3xjllEMPhChBKoeG3ojYKueasqRd4VTsglBwmS4AuJ\nbVIgVub6YPbqoZJXPshrJonZfv87MK00sVDiT2pNZefjpt7CpmaO92FsHS+d\nxQPPgZubC93ZY7WQFpEXb+shqcQ3DFrNXwG9Bm3pagtuVMtQJED+F32xhYAq\nXJS6DNA05zWVv71pd4ZgkWbzVSSkBDv63Y0i13nIJcSK9qu7IShri+0gIPgk\nd7lKX25KKv4IQHEKMONuQWl7avTA3jfMDMq3I4fJu0F74zwz1HmgmMKnkf6X\n5EvVJG/vqeG9K1je2BKg5y6GlrbYoEz4QGvLHoH34XKylYDxDrsSnc1Z0JbX\nqnW0pVIezCsTAkhyPTifj/DtsCqy/iv5z6WiD8VlNqCIFGA9te21d13qBng0\nlIaAyY9oqrjBTqAp9cvP4M5GFyUxUXhxvtB2TblQ6kL4BFcJGl0grbN9cyFt\n2gl3\r\n=CN26\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD65/381MLiHX3rt8aZPo7TusXrlQTw6t1cFF53fGBwswIhAOLx5Zh3K0o0oQbKYkO1Zcb5je8eYVRXBcXtNtvfU1KJ"}]},"maintainers":[{"name":"lucien-x","email":"coder89757@gmail.com"}],"_npmUser":{"name":"lucien-x","email":"coder89757@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/7-style-loader_1.1.3_1584010136781_0.8991131149615577"},"_hasShrinkwrap":false}},"time":{"created":"2020-03-12T10:48:56.781Z","1.1.3":"2020-03-12T10:48:56.929Z","modified":"2022-04-04T10:24:04.452Z"},"maintainers":[{"name":"lucien-x","email":"coder89757@gmail.com"}],"description":"style loader module for webpack","homepage":"https://github.com/webpack-contrib/style-loader","keywords":["webpack"],"repository":{"type":"git","url":"git+https://github.com/webpack-contrib/style-loader.git"},"author":{"name":"Tobias Koppers @sokra"},"bugs":{"url":"https://github.com/webpack-contrib/style-loader/issues"},"license":"MIT","readme":"<div align=\"center\">\n  <a href=\"https://github.com/webpack/webpack\">\n    <img width=\"200\" height=\"200\"\n      src=\"https://webpack.js.org/assets/icon-square-big.svg\">\n  </a>\n  <h1>Style Loader</h1>\n</div>\n\n[![npm][npm]][npm-url]\n[![node][node]][node-url]\n[![deps][deps]][deps-url]\n[![tests][tests]][tests-url]\n[![coverage][cover]][cover-url]\n[![chat][chat]][chat-url]\n[![size][size]][size-url]\n\n# 7-style-loader\n\n**This is a forked version of style-loader, modified for seven-modules**\n\nNew Feature:\n1. Extend the ability of attributes, you can use \"[moduleName]\" and \"[moduleVersion]\" template string in style tag attribute now.\n\n## Getting Started\n\nTo begin, you'll need to install `style-loader`:\n\n```console\nnpm install --save-dev style-loader\n```\n\nIt's recommended to combine `style-loader` with the [`css-loader`](https://github.com/webpack-contrib/css-loader)\n\nThen add the loader to your `webpack` config. For example:\n\n**style.css**\n\n```css\nbody {\n  background: green;\n}\n```\n\n**component.js**\n\n```js\nimport './style.css';\n```\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: ['style-loader', 'css-loader'],\n      },\n    ],\n  },\n};\n```\n\n## Options\n\n|              Name               |         Type         |  Default   | Description                                              |\n| :-----------------------------: | :------------------: | :--------: | :------------------------------------------------------- |\n| [**`injectType`**](#injecttype) |      `{String}`      | `styleTag` | Allows to setup how styles will be injected into the DOM |\n| [**`attributes`**](#attributes) |      `{Object}`      |    `{}`    | Adds custom attributes to tag                            |\n|     [**`insert`**](#insert)     | `{String\\|Function}` |   `head`   | Inserts tag at the given position into the DOM           |\n|       [**`base`**](#base)       |      `{Number}`      |   `true`   | Sets module ID base (DLLPlugin)                          |\n|   [**`esModule`**](#esmodule)   |     `{Boolean}`      |  `false`   | Use ES modules syntax                                    |\n\n### `injectType`\n\nType: `String`\nDefault: `styleTag`\n\nAllows to setup how styles will be injected into the DOM.\n\nPossible values:\n\n- `styleTag`\n- `singletonStyleTag`\n- `lazyStyleTag`\n- `lazySingletonStyleTag`\n- `linkTag`\n\n#### `styleTag`\n\nAutomatically injects styles into the DOM using multiple `<style></style>`. It is **default** behaviour.\n\n**component.js**\n\n```js\nimport './styles.css';\n```\n\nExample with Locals (CSS Modules):\n\n**component-with-css-modules.js**\n\n```js\nimport styles from './styles.css';\n\nconst divElement = document.createElement('div');\ndivElement.className = styles['my-class'];\n```\n\nAll locals (class names) stored in imported object.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: [\n          // The `injectType`  option can be avoided because it is default behaviour\n          { loader: 'style-loader', options: { injectType: 'styleTag' } },\n          'css-loader',\n        ],\n      },\n    ],\n  },\n};\n```\n\nThe loader inject styles like:\n\n```html\n<style>\n  .foo {\n    color: red;\n  }\n</style>\n<style>\n  .bar {\n    color: blue;\n  }\n</style>\n```\n\n#### `singletonStyleTag`\n\nAutomatically injects styles into the DOM using one `<style></style>`.\n\n> ⚠ Source maps do not work.\n\n**component.js**\n\n```js\nimport './styles.css';\n```\n\n**component-with-css-modules.js**\n\n```js\nimport styles from './styles.css';\n\nconst divElement = document.createElement('div');\ndivElement.className = styles['my-class'];\n```\n\nAll locals (class names) stored in imported object.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: [\n          {\n            loader: 'style-loader',\n            options: { injectType: 'singletonStyleTag' },\n          },\n          'css-loader',\n        ],\n      },\n    ],\n  },\n};\n```\n\nThe loader inject styles like:\n\n```html\n<style>\n  .foo {\n    color: red;\n  }\n  .bar {\n    color: blue;\n  }\n</style>\n```\n\n#### `lazyStyleTag`\n\nInjects styles into the DOM using multiple `<style></style>` on demand.\nWe recommend following `.lazy.css` naming convention for lazy styles and the `.css` for basic `style-loader` usage (similar to other file types, i.e. `.lazy.less` and `.less`).\nWhen you `lazyStyleTag` value the `style-loader` injects the styles lazily making them useable on-demand via `style.use()` / `style.unuse()`.\n\n> ⚠️ Behavior is undefined when `unuse` is called more often than `use`. Don't do that.\n\n**component.js**\n\n```js\nimport styles from './styles.lazy.css';\n\nstyles.use();\n// For removing styles you can use\n// styles.unuse();\n```\n\n**component-with-css-modules.js**\n\n```js\nimport styles from './styles.lazy.css';\n\nstyles.use();\n\nconst divElement = document.createElement('div');\ndivElement.className = styles.locals['my-class'];\n```\n\nAll locals (class names) stored in `locals` property of imported object.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        exclude: /\\.lazy\\.css$/i,\n        use: ['style-loader', 'css-loader'],\n      },\n      {\n        test: /\\.lazy\\.css$/i,\n        use: [\n          { loader: 'style-loader', options: { injectType: 'lazyStyleTag' } },\n          'css-loader',\n        ],\n      },\n    ],\n  },\n};\n```\n\nThe loader inject styles like:\n\n```html\n<style>\n  .foo {\n    color: red;\n  }\n</style>\n<style>\n  .bar {\n    color: blue;\n  }\n</style>\n```\n\n#### `lazySingletonStyleTag`\n\nInjects styles into the DOM using one `<style></style>` on demand.\nWe recommend following `.lazy.css` naming convention for lazy styles and the `.css` for basic `style-loader` usage (similar to other file types, i.e. `.lazy.less` and `.less`).\nWhen you `lazySingletonStyleTag` value the `style-loader` injects the styles lazily making them useable on-demand via `style.use()` / `style.unuse()`.\n\n> ⚠️ Source maps do not work.\n\n> ⚠️ Behavior is undefined when `unuse` is called more often than `use`. Don't do that.\n\n**component.js**\n\n```js\nimport styles from './styles.css';\n\nstyles.use();\n// For removing styles you can use\n// styles.unuse();\n```\n\n**component-with-css-modules.js**\n\n```js\nimport styles from './styles.lazy.css';\n\nstyles.use();\n\nconst divElement = document.createElement('div');\ndivElement.className = styles.locals['my-class'];\n```\n\nAll locals (class names) stored in `locals` property of imported object.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        exclude: /\\.lazy\\.css$/i,\n        use: ['style-loader', 'css-loader'],\n      },\n      {\n        test: /\\.lazy\\.css$/i,\n        use: [\n          {\n            loader: 'style-loader',\n            options: { injectType: 'lazySingletonStyleTag' },\n          },\n          'css-loader',\n        ],\n      },\n    ],\n  },\n};\n```\n\nThe loader generate this:\n\n```html\n<style>\n  .foo {\n    color: red;\n  }\n  .bar {\n    color: blue;\n  }\n</style>\n```\n\n#### `linkTag`\n\nInjects styles into the DOM using multiple `<link rel=\"stylesheet\" href=\"path/to/file.css\">` .\n\n> ℹ️ The loader will dynamically insert the `<link href=\"path/to/file.css\" rel=\"stylesheet\">` tag at runtime via JavaScript. You should use [MiniCssExtractPlugin](https://webpack.js.org/plugins/mini-css-extract-plugin/) if you want to include a static `<link href=\"path/to/file.css\" rel=\"stylesheet\">`.\n\n```js\nimport './styles.css';\nimport './other-styles.css';\n```\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.link\\.css$/i,\n        use: [\n          { loader: 'style-loader', options: { injectType: 'linkTag' } },\n          { loader: 'file-loader' },\n        ],\n      },\n    ],\n  },\n};\n```\n\nThe loader generate this:\n\n```html\n<link rel=\"stylesheet\" href=\"path/to/style.css\" />\n<link rel=\"stylesheet\" href=\"path/to/other-styles.css\" />\n```\n\n### `attributes`\n\nType: `Object`\nDefault: `{}`\n\nIf defined, the `style-loader` will attach given attributes with their values on `<style>` / `<link>` element.\n\n**component.js**\n\n```js\nimport style from './file.css';\n```\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: [\n          {\n            loader: 'style-loader',\n            options: {\n              attributes: { \n                id: 'id', \n                // according to \"name\" and \"version\" field in module.json \n                \"data-module-name\": '[moduleName]',\n                \"data-module-version\": '[moduleVersion]'\n              }\n            }\n          },\n          { loader: 'css-loader' },\n        ],\n      },\n    ],\n  },\n};\n```\n\n```html\n<style id=\"id\"></style>\n```\n\n### `insert`\n\nType: `String|Function`\nDefault: `head`\n\nBy default, the `style-loader` appends `<style>`/`<link>` elements to the end of the style target, which is the `<head>` tag of the page unless specified by `insert`.\nThis will cause CSS created by the loader to take priority over CSS already present in the target.\nYou can use other values if the standard behavior is not suitable for you, but we do not recommend doing this.\nIf you target an [iframe](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement) make sure you have sufficient access rights, the styles will be injected into the content document head.\n\n#### `String`\n\nAllows to setup custom [query selector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector) where styles inject into the DOM.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: [\n          {\n            loader: 'style-loader',\n            options: {\n              insert: 'body',\n            },\n          },\n          'css-loader',\n        ],\n      },\n    ],\n  },\n};\n```\n\nA new `<style>`/`<link>` elements will be inserted into at bottom of `body` tag.\n\n#### `Function`\n\nAllows to override default behavior and insert styles at any position.\n\n> ⚠ Do not forget that this code will be used in the browser and not all browsers support latest ECMA features like `let`, `const`, `arrow function expression` and etc, we recommend use only ECMA 5 features, but it is depends what browsers you want to support\n> ⚠ Do not forget that some DOM methods may not be available in older browsers, we recommended use only [DOM core level 2 properties](https://caniuse.com/#search=DOM%20Core), but it is depends what browsers you want to support\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: [\n          {\n            loader: 'style-loader',\n            options: {\n              insert: function insertAtTop(element) {\n                var parent = document.querySelector('head');\n                // eslint-disable-next-line no-underscore-dangle\n                var lastInsertedElement =\n                  window._lastElementInsertedByStyleLoader;\n\n                if (!lastInsertedElement) {\n                  parent.insertBefore(element, parent.firstChild);\n                } else if (lastInsertedElement.nextSibling) {\n                  parent.insertBefore(element, lastInsertedElement.nextSibling);\n                } else {\n                  parent.appendChild(element);\n                }\n\n                // eslint-disable-next-line no-underscore-dangle\n                window._lastElementInsertedByStyleLoader = element;\n              },\n            },\n          },\n          'css-loader',\n        ],\n      },\n    ],\n  },\n};\n```\n\nInsert styles at top of `head` tag.\n\n### `base`\n\nThis setting is primarily used as a workaround for [css clashes](https://github.com/webpack-contrib/style-loader/issues/163) when using one or more [DllPlugin](https://robertknight.github.io/posts/webpack-dll-plugins/)'s. `base` allows you to prevent either the _app_'s css (or _DllPlugin2_'s css) from overwriting _DllPlugin1_'s css by specifying a css module id base which is greater than the range used by _DllPlugin1_ e.g.:\n\n**webpack.dll1.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: ['style-loader', 'css-loader'],\n      },\n    ],\n  },\n};\n```\n\n**webpack.dll2.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: [\n          { loader: 'style-loader', options: { base: 1000 } },\n          'css-loader',\n        ],\n      },\n    ],\n  },\n};\n```\n\n**webpack.app.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: [\n          { loader: 'style-loader', options: { base: 2000 } },\n          'css-loader',\n        ],\n      },\n    ],\n  },\n};\n```\n\n### `esModule`\n\nType: `Boolean`\nDefault: `false`\n\nBy default, `style-loader` generates JS modules that use the CommonJS modules syntax.\nThere are some cases in which using ES modules is beneficial, like in the case of [module concatenation](https://webpack.js.org/plugins/module-concatenation-plugin/) and [tree shaking](https://webpack.js.org/guides/tree-shaking/).\n\nYou can enable a ES module syntax using:\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        loader: 'css-loader',\n        options: {\n          esModule: true,\n        },\n      },\n    ],\n  },\n};\n```\n\n## Examples\n\n### Source maps\n\nThe loader automatically inject source maps when previous loader emit them.\nTherefore, to generate source maps, set the `sourceMap` option to `true` for the previous loader.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: [\n          'style-loader',\n          { loader: 'css-loader', options: { sourceMap: true } },\n        ],\n      },\n    ],\n  },\n};\n```\n\n### Nonce\n\nThere are two ways to work with `nonce`:\n\n- using the `attributes` option\n- using the `__webpack_nonce__` variable\n\n> ⚠ the `attributes` option takes precedence over the `__webpack_nonce__` variable\n\n#### `attributes`\n\n**component.js**\n\n```js\nimport './style.css';\n```\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: [\n          {\n            loader: 'style-loader',\n            options: {\n              attributes: {\n                nonce: '12345678',\n              },\n            },\n          },\n          'css-loader',\n        ],\n      },\n    ],\n  },\n};\n```\n\nThe loader generate:\n\n```html\n<style nonce=\"12345678\">\n  .foo {\n    color: red;\n  }\n</style>\n```\n\n#### `__webpack_nonce__`\n\n**create-nonce.js**\n\n```js\n__webpack_nonce__ = '12345678';\n```\n\n**component.js**\n\n```js\nimport './create-nonce.js';\nimport './style.css';\n```\n\nAlternative example for `require`:\n\n**component.js**\n\n```js\n__webpack_nonce__ = '12345678';\n\nrequire('./style.css');\n```\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: ['style-loader', 'css-loader'],\n      },\n    ],\n  },\n};\n```\n\nThe loader generate:\n\n```html\n<style nonce=\"12345678\">\n  .foo {\n    color: red;\n  }\n</style>\n```\n\n#### Insert styles at top\n\nInserts styles at top of `head` tag.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: [\n          {\n            loader: 'style-loader',\n            options: {\n              insert: function insertAtTop(element) {\n                var parent = document.querySelector('head');\n                var lastInsertedElement =\n                  window._lastElementInsertedByStyleLoader;\n\n                if (!lastInsertedElement) {\n                  parent.insertBefore(element, parent.firstChild);\n                } else if (lastInsertedElement.nextSibling) {\n                  parent.insertBefore(element, lastInsertedElement.nextSibling);\n                } else {\n                  parent.appendChild(element);\n                }\n\n                window._lastElementInsertedByStyleLoader = element;\n              },\n            },\n          },\n          'css-loader',\n        ],\n      },\n    ],\n  },\n};\n```\n\n#### Insert styles before target element\n\nInserts styles before `#id` element.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/i,\n        use: [\n          {\n            loader: 'style-loader',\n            options: {\n              insert: function insertBeforeAt(element) {\n                const parent = document.querySelector('head');\n                const target = document.querySelector('#id');\n\n                const lastInsertedElement =\n                  window._lastElementInsertedByStyleLoader;\n\n                if (!lastInsertedElement) {\n                  parent.insertBefore(element, target);\n                } else if (lastInsertedElement.nextSibling) {\n                  parent.insertBefore(element, lastInsertedElement.nextSibling);\n                } else {\n                  parent.appendChild(element);\n                }\n\n                window._lastElementInsertedByStyleLoader = element;\n              },\n            },\n          },\n          'css-loader',\n        ],\n      },\n    ],\n  },\n};\n```\n\n## Contributing\n\nPlease take a moment to read our contributing guidelines if you haven't yet done so.\n\n[CONTRIBUTING](./.github/CONTRIBUTING.md)\n\n## License\n\n[MIT](./LICENSE)\n\n[npm]: https://img.shields.io/npm/v/style-loader.svg\n[npm-url]: https://npmjs.com/package/style-loader\n[node]: https://img.shields.io/node/v/style-loader.svg\n[node-url]: https://nodejs.org\n[deps]: https://david-dm.org/webpack-contrib/style-loader.svg\n[deps-url]: https://david-dm.org/webpack-contrib/style-loader\n[tests]: https://dev.azure.com/webpack-contrib/style-loader/_apis/build/status/webpack-contrib.style-loader?branchName=master\n[tests-url]: https://dev.azure.com/webpack-contrib/style-loader/_build/latest?definitionId=18&branchName=master\n[cover]: https://codecov.io/gh/webpack-contrib/style-loader/branch/master/graph/badge.svg\n[cover-url]: https://codecov.io/gh/webpack-contrib/style-loader\n[chat]: https://badges.gitter.im/webpack/webpack.svg\n[chat-url]: https://gitter.im/webpack/webpack\n[size]: https://packagephobia.now.sh/badge?p=style-loader\n[size-url]: https://packagephobia.now.sh/result?p=style-loader\n","readmeFilename":"README.md"}