mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-22 08:29:46 +00:00
Merge a68b0a50cc
into 160efe7a7f
This commit is contained in:
commit
45ee6d0da4
@ -85,7 +85,7 @@ export const bundle: NuxtBuilder['bundle'] = async (nuxt) => {
|
|||||||
// https://github.com/vitejs/vite/tree/main/packages/vite/src/node/build.ts#L464-L478
|
// https://github.com/vitejs/vite/tree/main/packages/vite/src/node/build.ts#L464-L478
|
||||||
assetFileNames: nuxt.options.dev
|
assetFileNames: nuxt.options.dev
|
||||||
? undefined
|
? undefined
|
||||||
: chunk => withoutLeadingSlash(join(nuxt.options.app.buildAssetsDir, `${sanitizeFilePath(filename(chunk.names[0]!))}.[hash].[ext]`)),
|
: chunk => withoutLeadingSlash(join(nuxt.options.app.buildAssetsDir, `${sanitizeFilePath(filename(chunk.names[0]!))}-[hash].[ext]`)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -1864,7 +1864,7 @@ describe.skipIf(isDev() || isWebpack)('inlining component styles', () => {
|
|||||||
// @ts-expect-error ssssh! untyped secret property
|
// @ts-expect-error ssssh! untyped secret property
|
||||||
const publicDir = useTestContext().nuxt._nitro.options.output.publicDir
|
const publicDir = useTestContext().nuxt._nitro.options.output.publicDir
|
||||||
const files = await readdir(join(publicDir, '_nuxt')).catch(() => [])
|
const files = await readdir(join(publicDir, '_nuxt')).catch(() => [])
|
||||||
expect(files.map(m => m.replace(/\.[\w-]+(\.\w+)$/, '$1'))).toContain('css-only-asset.svg')
|
expect(JSON.stringify(files.map(m => m.replace(/(-\w+)(\.\w+)$/, '$2')))).toContain('css_only_asset.svg')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not include inlined CSS in generated CSS file', async () => {
|
it('should not include inlined CSS in generated CSS file', async () => {
|
||||||
@ -1892,7 +1892,7 @@ describe.skipIf(isDev() || isWebpack)('inlining component styles', () => {
|
|||||||
const html: string = await $fetch<string>('/styles')
|
const html: string = await $fetch<string>('/styles')
|
||||||
const cssFiles = html.match(/<link [^>]*href="[^"]*\.css"/g)
|
const cssFiles = html.match(/<link [^>]*href="[^"]*\.css"/g)
|
||||||
expect(cssFiles?.length).toBeGreaterThan(0)
|
expect(cssFiles?.length).toBeGreaterThan(0)
|
||||||
expect(cssFiles?.filter(m => m.includes('entry'))?.map(m => m.replace(/\.[^.]*\.css/, '.css'))).toMatchInlineSnapshot(`
|
expect(cssFiles?.filter(m => m.includes('entry'))?.map(m => m.replace(/-[^-]*\.css/, '.css'))).toMatchInlineSnapshot(`
|
||||||
[
|
[
|
||||||
"<link rel="stylesheet" href="/_nuxt/entry.css"",
|
"<link rel="stylesheet" href="/_nuxt/entry.css"",
|
||||||
]
|
]
|
||||||
@ -2122,7 +2122,7 @@ describe('public directories', () => {
|
|||||||
|
|
||||||
// TODO: dynamic paths in dev
|
// TODO: dynamic paths in dev
|
||||||
describe.skipIf(isDev())('dynamic paths', () => {
|
describe.skipIf(isDev())('dynamic paths', () => {
|
||||||
const publicFiles = ['/public.svg', '/css-only-public-asset.svg']
|
const publicFiles = ['/public.svg', '/css_only_public_asset.svg']
|
||||||
const isPublicFile = (base = '/', file: string) => {
|
const isPublicFile = (base = '/', file: string) => {
|
||||||
if (isWebpack) {
|
if (isWebpack) {
|
||||||
// TODO: webpack does not yet support dynamic static paths
|
// TODO: webpack does not yet support dynamic static paths
|
||||||
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 201 B |
4
test/fixtures/basic/assets/global.css
vendored
4
test/fixtures/basic/assets/global.css
vendored
@ -1,5 +1,5 @@
|
|||||||
:root {
|
:root {
|
||||||
--global: 'global';
|
--global: 'global';
|
||||||
--asset: url('~/assets/css-only-asset.svg');
|
--asset: url('~/assets/css_only_asset.svg');
|
||||||
--public-asset: url('/css-only-public-asset.svg');
|
--public-asset: url('/css_only_public_asset.svg');
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 67 B After Width: | Height: | Size: 67 B |
Loading…
Reference in New Issue
Block a user