mirror of
https://github.com/element-plus/element-plus.git
synced 2025-04-06 16:30:35 +08:00
feat(docs): document website enhancement (#3580)
- Add language jump support - Fix ifBuild.sh bug on posix platform
This commit is contained in:
parent
139e79b29d
commit
7fa9afaa43
2
docs/.gitignore
vendored
2
docs/.gitignore
vendored
@ -1,5 +1,3 @@
|
||||
.vitepress/*.js
|
||||
|
||||
.vitepress/i18n/*
|
||||
temp
|
||||
zh-CN
|
||||
|
@ -59,6 +59,22 @@ module.exports = {
|
||||
href: '//unpkg.com/nprogress@0.2.0/nprogress.css',
|
||||
},
|
||||
],
|
||||
[
|
||||
'script',
|
||||
{},
|
||||
`;(() => {
|
||||
window.supportedLangs = ${JSON.stringify(languages)}
|
||||
})()`,
|
||||
],
|
||||
|
||||
[
|
||||
'script',
|
||||
{},
|
||||
require('fs').readFileSync(
|
||||
require('path').resolve(__dirname, './lang.js'),
|
||||
'utf-8'
|
||||
),
|
||||
],
|
||||
|
||||
features.theme
|
||||
? [
|
||||
|
15
docs/.vitepress/lang.js
Normal file
15
docs/.vitepress/lang.js
Normal file
@ -0,0 +1,15 @@
|
||||
;(() => {
|
||||
const supportedLangs = window.supportedLangs
|
||||
|
||||
const userPreferredLang =
|
||||
localStorage.getItem('preferred_lang') || navigator.language
|
||||
|
||||
if (
|
||||
supportedLangs.includes(userPreferredLang) &&
|
||||
!location.pathname.startsWith(`/${userPreferredLang}`)
|
||||
) {
|
||||
location.pathname = [`/${userPreferredLang}`]
|
||||
.concat(location.pathname.split('/').slice(2))
|
||||
.join('/')
|
||||
}
|
||||
})()
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -d \"dist/element-plus\" ]; then
|
||||
sh scripts/build.sh;
|
||||
if [ ! -d "dist/element-plus" ]; then
|
||||
sh scripts/build.sh
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user