Skip to content

Commit

Permalink
chore: 调整字体cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
ZvonimirSun committed Jul 19, 2024
1 parent 2680e72 commit dcaf1e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const config: {
readonly key: string

readonly domain: string
readonly cdnDomain: string
readonly site: string
readonly api: string
readonly cdn: string
Expand All @@ -31,6 +32,7 @@ const config: {
key: 'iszy',

domain: 'iszy.xyz',
cdnDomain: 'iszy.cc',
site: 'tools',
api: 'api',
cdn: 'cdn',
Expand All @@ -46,7 +48,7 @@ const config: {
return `${this.api}.${this.domain}`
},
get cdnHost() {
return `${this.cdn}.${this.domain}`
return `${this.cdn}.${this.cdnDomain || this.domain}`
},

get siteOrigin() {
Expand Down
6 changes: 6 additions & 0 deletions uno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import {
transformerDirectives,
transformerVariantGroup,
} from 'unocss'
import axios from 'axios'
import tools from './src/tools'
import config from './src/config'

const iconClass = tools.map(item => item.icon).filter(item => item)

Expand All @@ -23,6 +25,10 @@ export default defineConfig({
}),
presetWebFonts({
provider: 'google',
async customFetch(url) {
url = url.replace('fonts.googleapis.com', `fonts.${config.cdnHost}`)
return axios.get(url).then(res => res.data)
},
fonts: {
main: [
{
Expand Down

0 comments on commit dcaf1e0

Please sign in to comment.