Skip to content

Commit

Permalink
chore: add autoInjectGlobalCssImports theme property
Browse files Browse the repository at this point in the history
Default value is false and global CssImport (with just a value) is not injected by default to exported web components.
  • Loading branch information
tltv committed Aug 5, 2024
1 parent 896a6f1 commit 87dd3b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function writeThemeFiles(themeFolder, themeName, themeProperties, options) {
const styles = resolve(themeFolder, stylesCssFilename);
const documentCssFile = resolve(themeFolder, documentCssFilename);
const autoInjectComponents = themeProperties.autoInjectComponents ?? true;
const autoInjectGlobalCssImports = themeProperties.autoInjectGlobalCssImports ?? false;
const globalFilename = 'theme-' + themeName + '.global.generated.js';
const componentsFilename = 'theme-' + themeName + '.components.generated.js';
const themeFilename = 'theme-' + themeName + '.generated.js';
Expand Down Expand Up @@ -223,9 +224,11 @@ function writeThemeFiles(themeFolder, themeName, themeProperties, options) {
const removers = [];
if (target !== document) {
${shadowOnlyCss.join('')}
webcomponentGlobalCssInjector((css) => {
removers.push(injectGlobalCss(css, '', target));
});
${autoInjectGlobalCssImports ? `
webcomponentGlobalCssInjector((css) => {
removers.push(injectGlobalCss(css, '', target));
});
` : ''}
}
${parentTheme}
${globalCssCode.join('')}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"autoInjectGlobalCssImports": true,
"documentCss": ["@fortawesome/fontawesome-free/css/all.css"],
"assets": {
"@fortawesome/fontawesome-free": {
Expand Down

0 comments on commit 87dd3b5

Please sign in to comment.