Skip to content

Commit

Permalink
feat: remove extensions to be included by default
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Dec 14, 2023
1 parent c80aad5 commit 40e7c67
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,12 @@ function ThemeProvider({ children }) {
// (optional) defines with a glob where the styles are placed inside of @dnb/eufemia/...
filesGlobs: [
'**/style/dnb-ui-core.min.css',
'**/style/themes/**/*-theme-{basis,components,extensions}.min.css',
'**/style/themes/**/*-theme-{basis,components}.min.css',
],

// (optional) The file order does matter. Define a glob inside an array.
includeFiles: [
'**/dnb-ui-core.*',
'**/*-theme-extensions.*',
'**/*-theme-components.*',
'**/*-theme-basis.*',
],
Expand All @@ -79,9 +78,6 @@ function ThemeProvider({ children }) {
// (optional) when set to false, your app will not be wrapped with the needed `<Theme>` provider.
wrapWithThemeProvider: true,

// (optional) when set to false, your app will have to import the core styles (dnb-ui-core) by yourself.
coreStyleName: 'dnb-ui-core',

// (optional) when set to true, the page scroll behaviour will not be effected.
omitScrollBehavior: false,

Expand Down
13 changes: 2 additions & 11 deletions packages/gatsby-plugin-eufemia-theme-handler/src/collectThemes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export function createThemesImport({

return { file, themeName }
})
.filter(({ themeName }) => {
return limitThemes.length === 0 || limitThemes.includes(themeName)
.filter(({ file }) => {
return !/\/(cjs|es|esm)\//.test(file)
})
.sort((a, b) => {
return (
Expand All @@ -86,15 +86,6 @@ export function createThemesImport({
)
})

if (pluginOptions.coreStyleName) {
const coreFile = importFiles.find((file) =>
file.includes(pluginOptions.coreStyleName)
)
if (coreFile) {
sortedImportFiles.unshift({ file: coreFile })
}
}

if (pluginOptions.verbose) {
reporter.info(
`sortedImportFiles:\n${sortedImportFiles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@ exports.pluginOptionsSchema = ({ Joi }) => {
.optional()
.default([
'**/style/dnb-ui-core.min.css',
'**/style/themes/**/*-theme-{basis,components,extensions}.min.css',
'**/style/themes/**/*-theme-{basis,components}.min.css',
]),
includeFiles: Joi.array().optional().default([
// The file order does matter!
'**/dnb-ui-core.*',
'**/*-theme-extensions.*',
'**/*-theme-components.*',
'**/*-theme-basis.*',
]),
inlineDefaultTheme: Joi.boolean().optional().default(true),
wrapWithThemeProvider: Joi.boolean().optional().default(true),
coreStyleName: Joi.string().optional().default('dnb-ui-core'),
omitScrollBehavior: Joi.boolean().optional().default(false),
verbose: Joi.boolean().optional().default(false),
})
Expand Down

0 comments on commit 40e7c67

Please sign in to comment.