forked from yogstation13/demo-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request yogstation13#1 from Dominig12/update-yog
Update yog
- Loading branch information
Showing
77 changed files
with
12,525 additions
and
13,629 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
node_modules/ | ||
dist/ | ||
.publish/ | ||
_as/ |
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 @@ | ||
replays.taucetistation.net |
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
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,32 @@ | ||
import {readFileSync} from "fs"; | ||
import ejs from "ejs"; | ||
|
||
function find_chunk(bundle, name) { | ||
for(let item of Object.values(bundle)) { | ||
if(item.name.endsWith(name)) return item; | ||
} | ||
} | ||
|
||
function generate_html(bundle, template_path) { | ||
const template = readFileSync(template_path, "utf8"); | ||
return ejs.render(template, { | ||
main_bundle: find_chunk(bundle, "main").fileName | ||
}); | ||
} | ||
|
||
export default function htmlPlugin() { | ||
const template_path = "src/index.ejs"; | ||
return { | ||
name: "html-plugin", | ||
buildStart() { | ||
this.addWatchFile(template_path); | ||
}, | ||
async generateBundle(options, bundle) { | ||
this.emitFile({ | ||
fileName: "index.html", | ||
type: "asset", | ||
source: generate_html(bundle, template_path) | ||
}); | ||
} | ||
}; | ||
} |
Oops, something went wrong.