From dcde2713809de05080fae46809f8882fb403d42a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivo=20Ilic=CC=81?= Date: Sat, 21 Aug 2021 18:42:46 -0700 Subject: [PATCH] Upgraded from style-inject to style-implant --- README.md | 2 +- package.json | 2 +- src/postcss-loader.js | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 26fe589f..faecd465 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ Default: `true` Inject CSS into ``, it's always `false` when `extract: true`. -You can also use it as options for [`style-inject`](https://github.com/egoist/style-inject#options). +You can also use it as options for [`style-implant`](https://github.com/ivoilic/style-implant#options). It can also be a `function` , returning a `string` which is js code. diff --git a/package.json b/package.json index 5cb52270..e8115cf9 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "resolve": "^1.19.0", "rollup-pluginutils": "^2.8.2", "safe-identifier": "^0.4.2", - "style-inject": "^0.3.0" + "style-implant": "^0.3.x" }, "peerDependencies": { "postcss": "8.x" diff --git a/src/postcss-loader.js b/src/postcss-loader.js index bbac026c..ee2ff857 100644 --- a/src/postcss-loader.js +++ b/src/postcss-loader.js @@ -6,8 +6,8 @@ import { identifier } from 'safe-identifier' import humanlizePath from './utils/humanlize-path' import normalizePath from './utils/normalize-path' -const styleInjectPath = require - .resolve('style-inject/dist/style-inject.es') +const styleImplantPath = require + .resolve('style-implant/dist/es/style-implant') .replace(/[\\/]+/g, '/') function loadConfig(id, { ctx: configOptions, path: configPath }) { @@ -209,8 +209,8 @@ export default { if (!shouldExtract && shouldInject) { output += typeof options.inject === 'function' ? options.inject(cssVariableName, this.id) : '\n' + - `import styleInject from '${styleInjectPath}';\n` + - `styleInject(${cssVariableName}${Object.keys(options.inject).length > 0 ? + `import styleImplant from '${styleImplantPath}';\n` + + `styleImplant(${cssVariableName}${Object.keys(options.inject).length > 0 ? `,${JSON.stringify(options.inject)}` : '' });`