Skip to content

Commit

Permalink
feat(projects): iconify offline
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Nov 16, 2023
1 parent 4046a8b commit 388e504
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createApp } from 'vue';
import './plugins/assets';
import { setupNProgress } from './plugins';
import { setupNProgress, setupIconifyOffline } from './plugins';
import { setupStore } from './store';
import { setupRouter } from './router';
import { setupI18n } from './locales';
Expand All @@ -9,6 +9,8 @@ import App from './App.vue';
async function setupApp() {
setupNProgress();

setupIconifyOffline();

const app = createApp(App);

setupStore(app);
Expand Down
14 changes: 14 additions & 0 deletions src/plugins/iconify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { addAPIProvider, disableCache } from '@iconify/vue';

/**
* setup the iconify offline
*/
export function setupIconifyOffline() {
const { VITE_ICONIFY_URL } = import.meta.env;

if (VITE_ICONIFY_URL) {
addAPIProvider('', { resources: [VITE_ICONIFY_URL] });

disableCache('all');
}
}
1 change: 1 addition & 0 deletions src/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './nprogress';
export * from './iconify';
6 changes: 6 additions & 0 deletions src/typings/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,11 @@ declare namespace Env {
* whether to build with sourcemap
*/
readonly VITE_SOURCE_MAP?: Common.YesOrNo;
/**
* iconify api provider url
* @description if the project is deployed in intranet, you can set the api provider url to the local iconify server
* @link https://docs.iconify.design/api/providers.html
*/
readonly VITE_ICONIFY_URL?: string;
}
}

0 comments on commit 388e504

Please sign in to comment.