forked from importantimport/urara
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
61 lines (60 loc) · 1.57 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// vite define config
import { defineConfig } from 'vite'
// vite plugin
import UnoCSS from 'unocss/vite'
import { presetTagify, presetIcons, extractorSvelte } from 'unocss'
import { imagetools } from 'vite-imagetools'
import { sveltekit as SvelteKit } from '@sveltejs/kit/vite'
import { SvelteKitPWA } from '@vite-pwa/sveltekit'
// postcss & tailwindcss
import TailwindCSS from 'tailwindcss'
import tailwindConfig from './tailwind.config'
import autoprefixer from 'autoprefixer'
import cssnano from 'cssnano'
export default defineConfig({
envPrefix: 'URARA_',
build: {
sourcemap: false,
rollupOptions: {
cache: false
}
},
css: {
postcss: {
plugins: [
TailwindCSS(tailwindConfig),
autoprefixer(),
...(process.env.NODE_ENV === 'production'
? [
cssnano({
preset: ['default', { discardComments: { removeAll: true } }]
})
]
: [])
]
}
},
plugins: [
UnoCSS({
include: [/\.svelte$/, /\.md?$/, /\.ts$/],
extractors: [extractorSvelte],
presets: [
presetTagify({
extraProperties: (matched: string) => (matched.startsWith('i-') ? { display: 'inline-block' } : {})
}),
presetIcons({ scale: 1.5 })
]
}),
imagetools(),
SvelteKit(),
SvelteKitPWA({
registerType: 'autoUpdate',
manifest: false,
scope: '/',
workbox: {
globPatterns: ['posts.json', '**/*.{js,css,html,svg,ico,png,webp,avif}'],
globIgnores: ['**/sw*', '**/workbox-*']
}
})
]
})