Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Default: `true`

Inject CSS into `<head>`, 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.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions src/postcss-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down Expand Up @@ -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)}` :
''
});`
Expand Down