Skip to content

Commit 9f4c325

Browse files
authored
Playground fixes for debug.html, frame.html and full.html (#17372)
When the new playground was implemented, the secondary html files (debug.html, frame.html and full.html) broke due to the compilation hash being inserted into the `babylon.playground.{hash}.js` filename. These secondary html files were still pointing to the non-hash `babylon.playground.js` file, which is no longer being built, but may still be cached. This change updates the secondary html files to use the correct `babylon.playground.{hash}.js` filename. This change also fixes a scss deprecation warning for the color `lighten` function by replacing it with `color.adjust`.
1 parent 42677f0 commit 9f4c325

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed

packages/tools/playground/public/debug.html renamed to packages/tools/playground/debug.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
dataLayer.push(arguments);
1010
}
1111
gtag("js", new Date());
12-
12+
window.__PLAYGROUND_BUNDLE__ = "<%= PLAYGROUND_BUNDLE %>";
1313
gtag("config", "UA-41767310-2");
1414
</script>
1515
<title>Babylon.js Playground debug endpoint</title>

packages/tools/playground/public/frame.html renamed to packages/tools/playground/frame.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
dataLayer.push(arguments);
1010
}
1111
gtag("js", new Date());
12-
12+
window.__PLAYGROUND_BUNDLE__ = "<%= PLAYGROUND_BUNDLE %>";
1313
gtag("config", "UA-41767310-2");
1414
</script>
1515
<title>Babylon.js Playground</title>

packages/tools/playground/public/full.html renamed to packages/tools/playground/full.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html>
2+
<html lang="en">
33
<head>
44
<!-- Google tag (gtag.js) -->
55
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-41767310-2"></script>
@@ -9,7 +9,7 @@
99
dataLayer.push(arguments);
1010
}
1111
gtag("js", new Date());
12-
12+
window.__PLAYGROUND_BUNDLE__ = "<%= PLAYGROUND_BUNDLE %>";
1313
gtag("config", "UA-41767310-2");
1414
</script>
1515
<title>Babylon.js Playground</title>

packages/tools/playground/src/scss/editor.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@use "sass:color";
2+
13
.pg-monaco-wrapper {
24
--pg-font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
35
--pg-bar-height: 30px;
@@ -249,7 +251,7 @@
249251
background: #3f3461;
250252
}
251253
&:hover {
252-
background: lighten(#3f3461, 10%);
254+
background: color.adjust(#3f3461, $lightness: 10%);
253255
}
254256

255257
// svg {

packages/tools/playground/webpack.config.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,30 @@ module.exports = (env) => {
108108
},
109109
plugins: [
110110
...plugins,
111+
new HtmlWebpackPlugin({
112+
template: path.resolve(__dirname, "debug.html"),
113+
filename: "debug.html",
114+
templateParameters: (compilation) => ({
115+
PLAYGROUND_BUNDLE: `babylon.playground.${compilation.hash}.js`,
116+
}),
117+
inject: false,
118+
}),
119+
new HtmlWebpackPlugin({
120+
template: path.resolve(__dirname, "frame.html"),
121+
filename: "frame.html",
122+
templateParameters: (compilation) => ({
123+
PLAYGROUND_BUNDLE: `babylon.playground.${compilation.hash}.js`,
124+
}),
125+
inject: false,
126+
}),
127+
new HtmlWebpackPlugin({
128+
template: path.resolve(__dirname, "full.html"),
129+
filename: "full.html",
130+
templateParameters: (compilation) => ({
131+
PLAYGROUND_BUNDLE: `babylon.playground.${compilation.hash}.js`,
132+
}),
133+
inject: false,
134+
}),
111135
new HtmlWebpackPlugin({
112136
template: path.resolve(__dirname, "index.html"),
113137
templateParameters: (compilation) => ({

0 commit comments

Comments
 (0)