From 0ac967a94581ca833e8a9546c0ef0cddd67cb0e4 Mon Sep 17 00:00:00 2001 From: sercan Date: Fri, 30 Apr 2021 19:27:40 +0300 Subject: [PATCH] Removed optional chaining operators to support Node v12 Set the version on .nvmrc to 12 --- .nvmrc | 2 +- src/@fuse/tailwind/plugins/theming.js | 10 +++++++--- tailwind.config.js | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.nvmrc b/.nvmrc index 8351c193..48082f72 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -14 +12 diff --git a/src/@fuse/tailwind/plugins/theming.js b/src/@fuse/tailwind/plugins/theming.js index 1bedd0e7..c14b09c0 100644 --- a/src/@fuse/tailwind/plugins/theming.js +++ b/src/@fuse/tailwind/plugins/theming.js @@ -72,13 +72,17 @@ function generateThemesObject(themes) return _.map(_.cloneDeep(themes), (value, key) => { const theme = normalizeTheme(value); + const primary = (theme && theme.primary && theme.primary.DEFAULT) ? theme.primary.DEFAULT : normalizedDefaultTheme.primary.DEFAULT; + const accent = (theme && theme.accent && theme.accent.DEFAULT) ? theme.accent.DEFAULT : normalizedDefaultTheme.accent.DEFAULT; + const warn = (theme && theme.warn && theme.warn.DEFAULT) ? theme.warn.DEFAULT : normalizedDefaultTheme.warn.DEFAULT; + return _.fromPairs([ [ key, { - primary: theme?.primary?.DEFAULT ?? normalizedDefaultTheme.primary.DEFAULT, - accent : theme?.accent?.DEFAULT ?? normalizedDefaultTheme.accent.DEFAULT, - warn : theme?.warn?.DEFAULT ?? normalizedDefaultTheme.warn.DEFAULT + primary, + accent, + warn } ] ]); diff --git a/tailwind.config.js b/tailwind.config.js index f2986418..75d82c49 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -78,7 +78,7 @@ const config = { // development and production, we will decide whether to purge or not // by looking at the process arguments. If there is a "build" argument // with the "ng" command then we will enable the purge. - enabled: process?.argv?.find(arg => arg.includes('ng')) && process?.argv?.indexOf('build') !== -1, + enabled: process && process.argv && process.argv.find(arg => arg.includes('ng')) && process.argv.indexOf('build') !== -1, content: ['./src/**/*.{html,scss,ts}'], options: { safelist: {