Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
30bb5ea
chore: add @vuetify/unplugin-styles dependency
AndreyYolkin Apr 19, 2026
2245cb5
feat(styles): register @vuetify/unplugin-styles in configure-vite
AndreyYolkin Apr 19, 2026
79d78c8
refactor(styles): stop running experimental styles pre-compile
AndreyYolkin Apr 19, 2026
d2a313e
refactor(styles): remove internal styles plugin and compiler
AndreyYolkin Apr 19, 2026
5a17ecf
refactor(styles): drop cache-only helpers from utils/styles
AndreyYolkin Apr 19, 2026
17e090e
refactor(styles): remove stylesCachePath from context
AndreyYolkin Apr 19, 2026
a88ccc0
chore: move vitepress overrides from package.json to pnpm-workspace.yaml
AndreyYolkin Apr 21, 2026
8b4fe7a
chore(test): add playwright-core and test:e2e script
AndreyYolkin Apr 21, 2026
e4d3077
test(styles): unit matrix for @vuetify/unplugin-styles wiring in conf…
AndreyYolkin Apr 21, 2026
bac2570
test(styles): harden unplugin-styles unit matrix per code review
AndreyYolkin Apr 21, 2026
7ce1052
test(styles): minimal SSR fixture for unplugin-styles e2e
AndreyYolkin Apr 21, 2026
a263b65
test(styles): use relative custom-configuration import in styles-ssr …
AndreyYolkin Apr 21, 2026
9c401dd
test(styles): playwright SSR spec covering FOUC, hydration, client hi…
AndreyYolkin Apr 21, 2026
787f622
test(styles): restore STYLES_MODE env on teardown and add mode contex…
AndreyYolkin Apr 21, 2026
8e9c069
style(test): resolve lint errors in new test and fixture files
AndreyYolkin Apr 21, 2026
ae39f91
test(styles): add 404-response check, mark dev-mode failures as expected
AndreyYolkin Apr 21, 2026
a3be6c0
test(styles): drop it.fails marker now that dev-mode 404 regression i…
AndreyYolkin Apr 22, 2026
c9fb161
chore(deps): bump @vuetify/unplugin-styles to ^1.0.0-beta.8
AndreyYolkin Apr 22, 2026
7b361f0
chore(deps): bump @vuetify/unplugin-styles to ^1.0.0-beta.9
AndreyYolkin Apr 22, 2026
e509aa6
chore: remove unused upath dependency
AndreyYolkin May 3, 2026
5a7502d
Merge branch 'main' into feat/unplugin-styles-integration
AndreyYolkin May 3, 2026
7e6ebba
chore(deps): update @vuetify/unplugin-styles to beta.10
AndreyYolkin May 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/vuetify-nuxt-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,21 @@
"lint": "eslint .",
"lint:fix": "nr lint --fix",
"publint": "publint",
"test": "vitest run",
"test:watch": "vitest watch",
"test": "vitest run --exclude 'test/e2e/**'",
"test:watch": "vitest watch --exclude 'test/e2e/**'",
"test:e2e": "vitest run test/e2e",
"release": "bumpp"
},
"dependencies": {
"@nuxt/kit": "catalog:",
"@vuetify/unplugin-styles": "catalog:",
"defu": "catalog:",
"destr": "catalog:",
"pathe": "catalog:",
"perfect-debounce": "catalog:",
"semver": "catalog:",
"ufo": "catalog:",
"unconfig": "catalog:",
"upath": "catalog:",
"vite-plugin-vuetify": "catalog:",
"vuetify": "catalog:"
},
Expand All @@ -110,6 +111,7 @@
"eslint": "catalog:",
"luxon": "catalog:",
"nuxt": "catalog:",
"playwright-core": "catalog:",
"publint": "catalog:",
"rimraf": "catalog:",
"sass": "catalog:",
Expand All @@ -121,6 +123,7 @@
"build": {
"externals": [
"@vuetify/loader-shared",
"@vuetify/unplugin-styles",
"node:child_process",
"node:fs",
"consola",
Expand All @@ -131,7 +134,6 @@
"rollup",
"sass",
"sass-embedded",
"upath",
"ufo",
"unconfig",
"vite",
Expand Down
12 changes: 12 additions & 0 deletions packages/vuetify-nuxt-module/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,18 @@ export interface MOptions {
* Path to the custom Vuetify SASS configuration file.
*/
configFile: string
/**
* Caching options forwarded to `@vuetify/unplugin-styles`.
*
* @default true
*/
cache?: boolean | {
path?: string
sassOptions?: Record<string, unknown>
}
/**
* @deprecated Use `styles.cache` instead.
*/
experimental?: {
cache?: boolean
}
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify-nuxt-module/src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export interface VuetifyNuxtContext {
viteVersion: string
enableRules?: boolean
rulesConfiguration?: { fromLabs?: boolean, configFile?: string }
stylesCachePath?: string
stylesConfigFile?: string
}

Expand Down
23 changes: 19 additions & 4 deletions packages/vuetify-nuxt-module/src/utils/configure-vite.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import type { Nuxt } from '@nuxt/schema'
import type { ObjectImportPluginOptions } from '@vuetify/loader-shared'
import type { VuetifyNuxtContext } from './config'
import { isObject } from '@vuetify/loader-shared'
import Styles from '@vuetify/unplugin-styles/vite'
import defu from 'defu'
import semver from 'semver'
import { vuetifyConfigurationPlugin } from '../vite/vuetify-configuration-plugin'
import { vuetifyDateConfigurationPlugin } from '../vite/vuetify-date-configuration-plugin'
import { vuetifyIconsPlugin } from '../vite/vuetify-icons-configuration-plugin'
import { vuetifyImportPlugin } from '../vite/vuetify-import-plugin'
import { vuetifySSRClientHintsPlugin } from '../vite/vuetify-ssr-client-hints-plugin'
import { vuetifyStylesPlugin } from '../vite/vuetify-styles-plugin'
import { createTransformAssetUrls } from './index'
import { checkVuetifyPlugins } from './module'
import { isPackageExists } from './package'

function resolveStylesCache (stylesOption: { cache?: unknown, experimental?: { cache?: unknown } }) {
return stylesOption.cache ?? stylesOption.experimental?.cache
}

export function configureVite (configKey: string, nuxt: Nuxt, ctx: VuetifyNuxtContext) {
nuxt.hook('vite:extend', ({ config }) => checkVuetifyPlugins(config))
nuxt.hook('vite:extendConfig', viteInlineConfig => {
Expand Down Expand Up @@ -80,9 +85,19 @@ export function configureVite (configKey: string, nuxt: Nuxt, ctx: VuetifyNuxtCo
}

viteInlineConfig.plugins.push(vuetifyImportPlugin({ autoImport }))
// exclude styles plugin
if ((ctx.moduleOptions.styles as any) !== false && ctx.moduleOptions.styles !== 'none') {
viteInlineConfig.plugins.push(vuetifyStylesPlugin(ctx))

const stylesOption = ctx.moduleOptions.styles
if (stylesOption === 'none') {
viteInlineConfig.plugins.push(Styles({ styles: 'none' }))
} else if (isObject(stylesOption) && 'configFile' in stylesOption) {
if (!ctx.stylesConfigFile) {
throw new Error('vuetify-nuxt-module: styles.configFile could not be resolved')
}
const cache = resolveStylesCache(stylesOption)
viteInlineConfig.plugins.push(Styles({
settings: ctx.stylesConfigFile,
...(cache === undefined ? {} : { cache: cache as never }),
}))
}
viteInlineConfig.plugins.push(vuetifyConfigurationPlugin(ctx), vuetifyIconsPlugin(ctx), vuetifyDateConfigurationPlugin(ctx))
if (ctx.ssrClientHints.enabled) {
Expand Down
3 changes: 0 additions & 3 deletions packages/vuetify-nuxt-module/src/utils/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { prepareIcons } from './icons'
import { mergeVuetifyModules } from './layers'
import { cleanupBlueprint, detectDate, resolveVuetifyComponents } from './module'
import { prepareSSRClientHints } from './ssr-client-hints'
import { prepareVuetifyStyles } from './styles-compiler'

export async function load (
options: VuetifyModuleOptions,
Expand Down Expand Up @@ -108,8 +107,6 @@ export async function load (
}
}
}

await prepareVuetifyStyles(nuxt, ctx)
}

export function registerWatcher (options: VuetifyModuleOptions, nuxt: Nuxt, ctx: VuetifyNuxtContext) {
Expand Down
127 changes: 0 additions & 127 deletions packages/vuetify-nuxt-module/src/utils/styles-compiler.ts

This file was deleted.

68 changes: 2 additions & 66 deletions packages/vuetify-nuxt-module/src/utils/styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Nuxt } from '@nuxt/schema'
import { createHash } from 'node:crypto'
import { existsSync, readdirSync, rmSync, statSync } from 'node:fs'
import { isAbsolute, join, resolve } from 'pathe'
import { existsSync } from 'node:fs'
import { isAbsolute, resolve } from 'pathe'

export function resolveVuetifyConfigFile (configFile: string, nuxt: Nuxt) {
if (typeof configFile === 'string' && !isAbsolute(configFile)) {
Expand All @@ -14,66 +13,3 @@ export function resolveVuetifyConfigFile (configFile: string, nuxt: Nuxt) {
}
return configFile
}

export function createStylesCacheHash (
vuetifyVersion: string,
viteVersion: string,
configContent: string,
configFile: string,
) {
return createHash('sha256')
.update(vuetifyVersion)
.update(viteVersion)
.update(configContent)
.update(configFile)
.digest('hex')
.slice(0, 8)
}

export function resolveStylesCachePaths (rootDir: string, hash: string) {
const stylesDir = resolve(rootDir, 'node_modules/.cache/vuetify-nuxt-module/styles')
const cacheDir = join(stylesDir, hash)
return {
stylesDir,
cacheDir,
}
}

export function cleanupOldStylesCaches (stylesDir: string, currentHash: string) {
if (!existsSync(stylesDir)) {
return
}

const dirents = readdirSync(stylesDir, { withFileTypes: true })
for (const dirent of dirents) {
if (dirent.isDirectory() && dirent.name !== currentHash) {
rmSync(join(stylesDir, dirent.name), { recursive: true, force: true })
}
}
}

export function collectVuetifyCssFiles (vuetifyBase: string) {
const files: string[] = []
findCssFiles(join(vuetifyBase, 'lib/components'), files)
findCssFiles(join(vuetifyBase, 'lib/styles'), files)
return files
}

function findCssFiles (dir: string, fileList: string[] = []) {
if (!existsSync(dir)) {
return fileList
}
const files = readdirSync(dir)
for (const file of files) {
const filePath = join(dir, file)
const stat = statSync(filePath)
if (stat.isDirectory()) {
findCssFiles(filePath, fileList)
} else {
if (file.endsWith('.css')) {
fileList.push(filePath)
}
}
}
return fileList
}
Loading