Skip to content

Commit

Permalink
fix: add tw util for compatible versions and use unshift for module p…
Browse files Browse the repository at this point in the history
…aths
  • Loading branch information
ineshbose committed Feb 1, 2024
1 parent 8280b27 commit 3f0d6e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default defineNuxtModule<ModuleOptions>({
if (moduleOptions.editorSupport || moduleOptions.addTwUtil || isNuxt2()) {
const editorSupportConfig = resolveEditorSupportConfig(moduleOptions.editorSupport)

if (editorSupportConfig.autocompleteUtil || moduleOptions.addTwUtil) {
if ((editorSupportConfig.autocompleteUtil || moduleOptions.addTwUtil) && !isNuxt2()) {
addImports({
name: 'autocompleteUtil',
from: resolve('./runtime/utils'),
Expand Down
6 changes: 3 additions & 3 deletions src/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ export const resolveModulePaths = async (configPath: ModuleOptions['configPath']

if (Array.isArray(nuxt.options._layers) && nuxt.options._layers.length > 1) {
const layerPaths = await Promise.all(
nuxt.options._layers.slice(1).reverse().map(async (layer): Promise<[string[], string[]]> => ([
nuxt.options._layers.slice(1).map(async (layer): Promise<[string[], string[]]> => ([
await resolveConfigPath(layer?.config?.tailwindcss?.configPath || join(layer.cwd, 'tailwind.config')),
resolveContentPaths(layer?.config?.srcDir || layer.cwd, defu(layer.config, nuxt.options) as typeof nuxt.options)
])))

layerPaths.forEach(([configPaths, contentPaths]) => {
mainPaths[0].push(...configPaths)
mainPaths[1].push(...contentPaths)
mainPaths[0].unshift(...configPaths)
mainPaths[1].unshift(...contentPaths)
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export type EditorSupportConfig = {
/**
* Enable utility to write Tailwind CSS classes inside strings.
*
* You will need to update `.vscode/settings.json` based on this value.
* You will need to update `.vscode/settings.json` based on this value. This works only for Nuxt 3 or Nuxt 2 with Bridge.
*
* ```json
* {
Expand Down

0 comments on commit 3f0d6e1

Please sign in to comment.