Skip to content

Commit

Permalink
fix: remove indents from 'body' tags
Browse files Browse the repository at this point in the history
  • Loading branch information
konpeki622 committed Jul 1, 2021
1 parent 82b9ef4 commit 1102bbc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/generate/geneIndexHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ export function geneIndexHtml (rootDir: string, config: Config): void {

export function injectHtml (source: string, entries: string[]): string {
const bodyRegex = /<body[^>]*>((.|[\n\r])*)<\/body>/im
let body = ' <body>\n'
body += ' <div id="app"></div>\n'
let body = '<body>\n'
body += ' <div id="app"></div>\n'
for (const entry of entries) {
if (entry !== undefined) {
body += ` <script type="module" src="${entry}"></script>\n`
body += ` <script type="module" src="${entry}"></script>\n`
}
}
body += ' </body>'
body += '</body>'
const result = source.replace(bodyRegex, body)
return result
}
Expand Down
20 changes: 10 additions & 10 deletions src/template/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

0 comments on commit 1102bbc

Please sign in to comment.