Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(console): replace inject html #2560

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion console/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta http-equiv="Cache-Control" content="public" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Homepage | Starwhale MLOps service" />
%__INJECT__%
<!--__INJECT__-->
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down
12 changes: 6 additions & 6 deletions console/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ const htmlPlugin = (mode) => {
return {
name: 'html-transform',
transformIndexHtml(html) {
if (mode === 'extend')
return html.replace(
/%__INJECT__%/,
`<script>
return html.replace(
/<!--__INJECT__-->/,
mode === 'extend'
? `<script>
var _hmt = _hmt || []
;(function () {
var hm = document.createElement('script')
Expand All @@ -71,8 +71,8 @@ const htmlPlugin = (mode) => {
s.parentNode.insertBefore(hm, s)
})()
</script>`
)
return html
: ''
)
},
}
}
Expand Down
Loading