Skip to content

Commit

Permalink
fix: put back app.config for hmr
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed May 4, 2023
1 parent f5c0030 commit 626409e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 29 deletions.
10 changes: 7 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { iconsPlugin, getIconCollections } from '@egoist/tailwindcss-icons'
import { defu } from 'defu'
import { name, version } from '../package.json'
import { colorsAsRegex, excludeColors } from './runtime/utils/colors'
import { ui as preset } from './preset'
import appConfig from './runtime/app.config'
import type { DeepPartial } from './runtime/types'

// @ts-ignore
Expand All @@ -24,7 +24,7 @@ declare module 'nuxt/schema' {
primary?: string
gray?: string
colors?: string[]
} & DeepPartial<typeof preset>
} & DeepPartial<typeof appConfig.ui>
}
}

Expand Down Expand Up @@ -65,7 +65,11 @@ export default defineNuxtModule<ModuleOptions>({

nuxt.options.css.push(resolve(runtimeDir, 'ui.css'))

nuxt.options.appConfig.ui = defu(nuxt.options.appConfig.ui, preset)
nuxt.options.appConfig.ui = defu(nuxt.options.appConfig.ui, appConfig.ui)

nuxt.hook('app:resolve', (app) => {
app.configs.push(resolve(runtimeDir, 'app.config'))
})

// @ts-ignore
nuxt.hook('tailwindcss:config', function (tailwindConfig: TailwindConfig) {
Expand Down
54 changes: 28 additions & 26 deletions src/preset.ts → src/runtime/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,30 +677,32 @@ const notifications = {
container: 'px-4 sm:px-6 py-6 space-y-3 overflow-y-auto'
}

export const ui = {
avatar,
avatarGroup,
badge,
button,
buttonGroup,
dropdown,
input,
inputGroup,
textarea,
select,
selectMenu,
checkbox,
radio,
toggle,
card,
container,
verticalNavigation,
commandPalette,
modal,
slideover,
popover,
tooltip,
contextMenu,
notification,
notifications
export default {
ui: {
avatar,
avatarGroup,
badge,
button,
buttonGroup,
dropdown,
input,
inputGroup,
textarea,
select,
selectMenu,
checkbox,
radio,
toggle,
card,
container,
verticalNavigation,
commandPalette,
modal,
slideover,
popover,
tooltip,
contextMenu,
notification,
notifications
}
}

0 comments on commit 626409e

Please sign in to comment.