General source code refactoring
This commit is contained in:
20
src/content/styles.js
Normal file
20
src/content/styles.js
Normal file
@@ -0,0 +1,20 @@
|
||||
function createContentStyles({
|
||||
STYLE_ID,
|
||||
redwoodStyles,
|
||||
environment
|
||||
}) {
|
||||
const { document } = environment;
|
||||
function ensureExtensionStyles() {
|
||||
if (document.getElementById(STYLE_ID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.id = STYLE_ID;
|
||||
style.textContent = redwoodStyles;
|
||||
|
||||
document.head.append(style);
|
||||
}
|
||||
|
||||
return { ensureExtensionStyles };
|
||||
}
|
||||
Reference in New Issue
Block a user