Skip to content

Commit

Permalink
feat: move fonts to plugin-fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo committed May 30, 2024
1 parent b6e6a26 commit ec00e78
Show file tree
Hide file tree
Showing 25 changed files with 85 additions and 3 deletions.
1 change: 1 addition & 0 deletions plugins/plugin-fonts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @vuepress-plume/plugin-fonts
47 changes: 47 additions & 0 deletions plugins/plugin-fonts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "@vuepress-plume/plugin-fonts",
"type": "module",
"version": "1.0.0-rc.61",
"description": "The Plugin for VuePres 2 - fonts",
"author": "pengzhanbo <volodymyr@foxmail.com>",
"license": "MIT",
"homepage": "https://github.com/pengzhanbo/vuepress-theme-plume#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/pengzhanbo/vuepress-theme-plume.git",
"directory": "plugins/plugin-fonts"
},
"bugs": {
"url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues"
},
"exports": {
".": {
"types": "./lib/node/index.d.ts",
"import": "./lib/node/index.js"
},
"./package.json": "./package.json"
},
"main": "lib/node/index.js",
"types": "./lib/node/index.d.ts",
"files": [
"lib"
],
"scripts": {
"build": "pnpm run copy && pnpm run ts",
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png,woff2}\" lib",
"ts": "tsc -b tsconfig.build.json"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.12"
},
"publishConfig": {
"access": "public"
},
"keyword": [
"VuePress",
"vuepress plugin",
"fonts",
"vuepress-plugin-fonts"
]
}
3 changes: 3 additions & 0 deletions plugins/plugin-fonts/src/client/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import './styles/fonts.css'

export default {}
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,3 @@
local("Source Han Sans SC");
unicode-range: U+2018, U+2019, U+201C, U+201D; /* 分别是 ‘’“” */
}

/* Generate the subsetted fonts using: `pyftsubset <file>.woff2 --unicodes="<range>" --output-file="inter-<style>-<subset>.woff2" --flavor=woff2` */
1 change: 1 addition & 0 deletions plugins/plugin-fonts/src/node/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './plugin.js'
12 changes: 12 additions & 0 deletions plugins/plugin-fonts/src/node/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { Plugin } from 'vuepress/core'
import { getDirname, path } from 'vuepress/utils'

export function fontsPlugin(): Plugin {
return {
name: '@vuepress-plume/plugin-fonts',
clientConfigFile: path.resolve(
getDirname(import.meta.url),
'../client/config.js',
),
}
}
8 changes: 8 additions & 0 deletions plugins/plugin-fonts/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.build.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./lib"
},
"include": ["./src"]
}
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"@vuepress-plume/plugin-baidu-tongji": "workspace:*",
"@vuepress-plume/plugin-blog-data": "workspace:*",
"@vuepress-plume/plugin-content-update": "workspace:*",
"@vuepress-plume/plugin-fonts": "workspace:*",
"@vuepress-plume/plugin-iconify": "workspace:*",
"@vuepress-plume/plugin-notes-data": "workspace:*",
"@vuepress-plume/plugin-search": "workspace:*",
Expand Down
1 change: 0 additions & 1 deletion theme/src/client/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@import "vars";
@import "fonts";
@import "normalize";
@import "icons";
@import "social-icons";
Expand Down
3 changes: 3 additions & 0 deletions theme/src/node/plugins/getPlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { contentUpdatePlugin } from '@vuepress-plume/plugin-content-update'
import { searchPlugin } from '@vuepress-plume/plugin-search'
import { markdownPowerPlugin } from 'vuepress-plugin-md-power'
import { watermarkPlugin } from '@vuepress/plugin-watermark'
import { fontsPlugin } from '@vuepress-plume/plugin-fonts'
import type {
PlumeThemeEncrypt,
PlumeThemeLocaleOptions,
Expand Down Expand Up @@ -64,6 +65,8 @@ export function getPlugins({

iconifyPlugin(),

fontsPlugin(),

contentUpdatePlugin(),

activeHeaderLinksPlugin({
Expand Down

0 comments on commit ec00e78

Please sign in to comment.