mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 22:55:48 +01:00
handle inline javascript in assetbundle.go
This commit is contained in:
parent
06ebe5f51f
commit
8a5287794e
3 changed files with 27 additions and 1 deletions
|
|
@ -137,7 +137,7 @@ func (a *AssetBundle) processHTML(htmldata string) error {
|
|||
break
|
||||
}
|
||||
}
|
||||
if !paths.Contains(asset.Path) {
|
||||
if !paths.Contains(asset.Path) && asset.Path != "" {
|
||||
err := asset.Load(a.basedirectory)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -44,6 +44,17 @@ func TestNewAssetBundle(t *testing.T) {
|
|||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "inline javascript",
|
||||
pathToHTML: "testdata/inline_javascript.html",
|
||||
wantAssets: []string{
|
||||
AssetTypes.HTML,
|
||||
AssetTypes.FAVICON,
|
||||
AssetTypes.JS,
|
||||
AssetTypes.CSS,
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
|
|||
15
v2/internal/html/testdata/inline_javascript.html
vendored
Normal file
15
v2/internal/html/testdata/inline_javascript.html
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg"></link>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<script type="text/javascript" src="src/bundle.js"></script>
|
||||
<link rel="stylesheet" href="src/style.css"></link>
|
||||
<title>Vite App</title>
|
||||
<script>console.log("test")</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue