Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(theme): remove $themeColorPicker in config.scss
- Loading branch information
1 parent
0a49566
commit 50f841e
Showing
13 changed files
with
121 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { addViteOptimizeDeps } from "@mr-hope/vuepress-shared"; | ||
import { handleWebpackOptions } from "./encrypt"; | ||
|
||
import { App } from "@vuepress/core"; | ||
|
||
export const updateBundlerOptions = (app: App): void => { | ||
addViteOptimizeDeps(app, [ | ||
"@vueuse/core", | ||
"bcryptjs", | ||
"body-scroll-lock", | ||
"lodash.throttle", | ||
]); | ||
|
||
if (app.env.isDev) | ||
addViteOptimizeDeps(app, [ | ||
"@mr-hope/vuepress-shared/lib/client", | ||
"dayjs", | ||
"dayjs/plugin/localizedFormat", | ||
"dayjs/plugin/objectSupport", | ||
"dayjs/plugin/timezone", | ||
"dayjs/plugin/utc", | ||
]); | ||
|
||
handleWebpackOptions(app); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./getConfig"; | ||
export * from "./use"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { useGitPlugin } from "@mr-hope/vuepress-shared"; | ||
import { path } from "@vuepress/utils"; | ||
import { useReadingTimePlugin } from "vuepress-plugin-reading-time2"; | ||
import { useSassPalettePlugin } from "vuepress-plugin-sass-palette"; | ||
|
||
import type { App } from "@vuepress/core"; | ||
import type { HopeThemePluginsOptions } from "../../shared"; | ||
|
||
export const usePlugin = (app: App, plugins: HopeThemePluginsOptions): void => { | ||
// only use git plugin in production or debug mode | ||
if (app.env.isDebug || app.env.isBuild) | ||
useGitPlugin(app, { | ||
createdTime: true, | ||
contributors: true, | ||
updatedTime: true, | ||
}); | ||
|
||
useReadingTimePlugin(app, { | ||
wordPerminute: plugins.readingTime?.wordPerminute, | ||
}); | ||
|
||
useSassPalettePlugin(app, { | ||
id: "hope", | ||
config: ".vuepress/styles/config.scss", | ||
defaultConfig: path.resolve(__dirname, "../../../templates/config.scss"), | ||
defaultPalette: path.resolve(__dirname, "../../../templates/palette.scss"), | ||
generator: path.resolve(__dirname, "../../../templates/generator.scss"), | ||
palette: ".vuepress/styles/palette.scss", | ||
style: ".vuepress/styles/index.scss", | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { App } from "@vuepress/core"; | ||
import { HopeThemeConfig } from "../shared"; | ||
|
||
export const writeThemeColorScss = async ( | ||
app: App, | ||
themeConfig: HopeThemeConfig | ||
): Promise<void> => { | ||
const themeColorOptions = themeConfig.themeColor || {}; | ||
|
||
let content = "$themeColorPicker: ("; | ||
|
||
for (const color in themeColorOptions) | ||
content += `"${color}": ${themeColorOptions[color]},`; | ||
|
||
content += ");"; | ||
|
||
await app.writeTemp("theme-hope/theme-color.scss", content); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters