rollup-plugin-postcss icon indicating copy to clipboard operation
rollup-plugin-postcss copied to clipboard

anyway to external styleInject function to prevent the duplicate?

Open lili21 opened this issue 3 years ago • 3 comments

lili21 avatar Apr 22 '21 09:04 lili21

@lili21 I have the same issue. The style-inject package using wrong relative path! As shown below~

image

I hope it can become like this. or anyway to external it, please~

var styleInject = require('style-inject/dist/style-inject.es.js');

Flcwl avatar May 13 '21 10:05 Flcwl

It also not work~ image

Flcwl avatar May 13 '21 12:05 Flcwl

Probably a bit late but I dealt with the same issues while trying to build a precompiled library excluding the css injection part. it is possible to override the code output by setting up a inject parameter function:

postcss({
  ...,
  inject(cssVariableName) {
    return `import styleInject from 'style-inject';\nstyleInject(${cssVariableName});`;
  }
})

hope it helps to anyone trying to find a workaround.

willyelm avatar Dec 11 '21 12:12 willyelm