Skip to content

Commit

Permalink
Merge pull request #764 from sebgroup/develop
Browse files Browse the repository at this point in the history
new release fix
  • Loading branch information
mario-subo authored Aug 12, 2022
2 parents 3a92e3b + 4718e1f commit c24d1be
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ const components = require("./src/index.json");

function injectCSS(css, uniqueId) {
if (!css || typeof document === "undefined") {
console.error("injectCSS error: no css or document undefined ");
return;
}

const exists = !!document.querySelector(`style[id="${uniqueId}"]`);
if (exists) {
if (uniqueId && exists) {
return;
}

Expand Down Expand Up @@ -50,7 +51,7 @@ export default [
(varname, id) => {
const filePathArray = id.split("\\");
const file = filePathArray[filePathArray.length - 1].split(".");
return `${varname} = ${injectCSS(varname, `rc-${file[0]}`)};`;
return `const inject = ${injectCSS};\n${varname} = inject(${varname}, "rc-${file[0]}");`;
},
],
}),
Expand Down Expand Up @@ -78,7 +79,7 @@ export default [
(varname, id) => {
const filePathArray = id.split("\\");
const file = filePathArray[filePathArray.length - 1].split(".");
return `${varname} = ${injectCSS(varname, `rc-${file[0]}`)};`;
return `const inject = ${injectCSS};\n${varname} = inject(${varname}, "rc-${file[0]}");`;
},
],
}),
Expand Down

0 comments on commit c24d1be

Please sign in to comment.