mirror of
https://github.com/interstellar750/hexo_s
synced 2024-09-08 09:32:38 +08:00
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
// vite define config
|
|
import { defineConfig } from 'vite'
|
|
// vite plugin
|
|
import UnoCSS from 'unocss/vite'
|
|
import { presetTagify, presetIcons } from 'unocss'
|
|
import extractorSvelte from '@unocss/extractor-svelte'
|
|
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'
|
|
// @ts-expect-error ts(7016)
|
|
import LightningCSS from 'postcss-lightningcss'
|
|
|
|
export default defineConfig({
|
|
envPrefix: 'URARA_',
|
|
build: {
|
|
sourcemap: false,
|
|
rollupOptions: {
|
|
cache: false
|
|
}
|
|
},
|
|
css: {
|
|
postcss: {
|
|
plugins: [TailwindCSS(tailwindConfig), LightningCSS()]
|
|
}
|
|
},
|
|
plugins: [
|
|
UnoCSS({
|
|
content: { pipeline: { include: [/\.svelte$/, /\.md?$/, /\.ts$/] } },
|
|
extractors: [extractorSvelte],
|
|
presets: [
|
|
presetTagify({
|
|
extraProperties: (matched: string) => (matched.startsWith('i-') ? { display: 'inline-block' } : {})
|
|
}),
|
|
presetIcons({ scale: 1.5 })
|
|
]
|
|
}),
|
|
SvelteKit(),
|
|
SvelteKitPWA({
|
|
registerType: 'autoUpdate',
|
|
manifest: false,
|
|
scope: '/',
|
|
workbox: {
|
|
globPatterns: ['posts.json', '**/*.{js,css,html,svg,ico,png,webp,avif}'],
|
|
globIgnores: ['**/sw*', '**/workbox-*']
|
|
}
|
|
})
|
|
]
|
|
}) |