Skip to content

Commit 8fd90b8

Browse files
committed
https://github.com/haxtheweb/issues/issues/2019
1 parent 9c51927 commit 8fd90b8

File tree

8 files changed

+236
-32
lines changed

8 files changed

+236
-32
lines changed

package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,34 @@
4343
"node": ">=18.20.3"
4444
},
4545
"dependencies": {
46+
"archiver": "7.0.1",
47+
"cookie-parser": "1.4.6",
48+
"dotenv": "16.4.5",
49+
"express": "4.19.2",
4650
"fs-extra": "11.2.0",
47-
"locutus": "2.0.32",
51+
"git-interface": "2.1.2",
4852
"helmet": "7.1.0",
49-
"express": "4.19.2",
53+
"jsonwebtoken": "9.0.2",
54+
"locutus": "2.0.32",
55+
"mime": "3.0.0",
56+
"minimist": "1.2.8",
57+
"multer": "1.4.5-lts.1",
5058
"open": "8.4.2",
51-
"sharp": "0.33.4",
52-
"archiver": "7.0.1",
53-
"uuid": "10.0.0",
54-
"yaml": "2.4.5",
59+
"sharp": "^0.33.4",
5560
"twig": "1.17.1",
56-
"minimist": "1.2.8",
5761
"utf8": "3.0.0",
58-
"git-interface": "2.1.2",
59-
"jsonwebtoken": "9.0.2",
60-
"cookie-parser": "1.4.6",
61-
"multer": "1.4.5-lts.1",
62-
"dotenv": "16.4.5",
63-
"mime": "3.0.0"
62+
"uuid": "10.0.0",
63+
"yaml": "2.4.5"
6464
},
6565
"devDependencies": {
66-
"nodemon": "3.1.4",
67-
"connect-livereload": "0.6.1",
68-
"livereload": "0.9.3",
69-
"commit-and-tag-version": "12.4.1",
7066
"@babel/cli": "^7.24.6",
7167
"@babel/core": "^7.24.6",
68+
"@babel/preset-env": "7.24.6",
7269
"@babel/register": "^7.24.6",
7370
"babel-plugin-transform-dynamic-import": "^2.1.0",
74-
"@babel/preset-env": "7.24.6"
71+
"commit-and-tag-version": "12.4.1",
72+
"connect-livereload": "0.6.1",
73+
"livereload": "0.9.3",
74+
"nodemon": "3.1.4"
7575
}
7676
}
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<base href="{{ basePath }}" />
5+
{{ metadata|raw }}
6+
<!-- Start Single Page Apps for GitHub Pages -->
7+
<script>
8+
// Single Page Apps for GitHub Pages
9+
// https://github.com/rafrex/spa-github-pages
10+
// Copyright (c) 2016 Rafael Pedicini, licensed under the MIT License
11+
// ----------------------------------------------------------------------
12+
// This script checks to see if a redirect is present in the query string
13+
// and converts it back into the correct url and adds it to the
14+
// browser's history using window.history.replaceState(...),
15+
// which won't cause the browser to attempt to load the new url.
16+
// When the single page app is loaded further down in this file,
17+
// the correct url will be waiting in the browser's history for
18+
// the single page app to route accordingly.
19+
(function (l) {
20+
if (l.search) {
21+
var q = {};
22+
l.search.slice(1).split('&').forEach(function (v) {
23+
var a = v.split('=');
24+
q[a[0]] = a.slice(1).join('=').replace(/~and~/g, '&');
25+
});
26+
if (q.p !== undefined) {
27+
window.history.replaceState(null, null,
28+
l.pathname.slice(0, -1) + (q.p || '') +
29+
(q.q ? ('?' + q.q) : '') +
30+
l.hash
31+
);
32+
}
33+
}
34+
}(window.location))
35+
</script>
36+
<!-- End Single Page Apps for GitHub Pages -->
37+
{{ serviceWorkerScript|raw }}
38+
<style>
39+
body {
40+
margin: 0;
41+
min-height: 98vh;
42+
}
43+
.use-modern-browser a {
44+
font-size: 22px;
45+
}
46+
.use-modern-browser {
47+
font-size: 22px;
48+
text-align: center;
49+
width: 100%;
50+
}
51+
</style>
52+
<style id="loadingstyles">
53+
haxcms-site-builder {
54+
display: block;
55+
}
56+
body[no-js] haxcms-site-builder {
57+
display: none !important;
58+
}
59+
#loading {
60+
background-color: white;
61+
bottom: 0px;
62+
left: 0px;
63+
opacity: 1;
64+
position: absolute;
65+
right: 0px;
66+
top: 0px;
67+
transition: all linear 300ms;
68+
-webkit-transition: all linear 300ms;
69+
z-index: 99999999;
70+
}
71+
72+
#loading.loaded {
73+
animation: fade-out .7s ease-in-out;
74+
animation-fill-mode: forwards;
75+
}
76+
#loading div.messaging {
77+
color: rgba(255,255,255, 0.7);
78+
font-family: Roboto;
79+
left: 0px;
80+
margin-top: -75px;
81+
position: absolute;
82+
right: 0px;
83+
text-align: center;
84+
top: 50%;
85+
transform: translateY(-50%);
86+
}
87+
#loading div.messaging h1 {
88+
color: white;
89+
font-family: 'Open Sans', 'arial', 'serif';
90+
font-size: 40px;
91+
background-color: orange;
92+
transition: .4s ease-in-out all;
93+
}
94+
#loading img {
95+
transition: .4s all ease-in-out;
96+
width: 300px;
97+
height: 300px;
98+
margin-bottom: 50px;
99+
border-radius: 50%;
100+
border: 8px solid orange;
101+
box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.45);
102+
-moz-box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.45);
103+
-webkit-box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.45);
104+
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#444444')";
105+
}
106+
.progress-line,
107+
.progress-line:before {
108+
height: 8px;
109+
width: 100%;
110+
margin: auto;
111+
}
112+
.progress-line {
113+
background-color: rgba(0,0,0, 0.05);
114+
display: -webkit-flex;
115+
display: flex;
116+
width: 300px;
117+
}
118+
.progress-line:before {
119+
background-color: orange;
120+
content: '';
121+
animation: running-progress 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
122+
}
123+
@keyframes running-progress {
124+
0% {
125+
margin-left: 0px;
126+
margin-right: 100%;
127+
}
128+
50% {
129+
margin-left: 25%;
130+
margin-right: 0%;
131+
}
132+
100% {
133+
margin-left: 100%;
134+
margin-right: 0;
135+
}
136+
}
137+
@keyframes fade-out {
138+
0% {
139+
opacity: 1;
140+
}
141+
99% {
142+
opacity: 0;
143+
}
144+
100% {
145+
opacity: 0;
146+
}
147+
}
148+
</style>
149+
<script id="loadingscript">
150+
window.addEventListener('haxcms-ready', function(e) {
151+
// give the web components a second to build
152+
setTimeout(function() {
153+
document.querySelector('#loading').classList.add('loaded');
154+
setTimeout(function() {
155+
document.querySelector('#loading').parentNode.removeChild(document.querySelector('#loading'));
156+
document.querySelector('#loadingstyles').parentNode.removeChild(document.querySelector('#loadingstyles'));
157+
document.querySelector('#loadingscript').parentNode.removeChild(document.querySelector('#loadingscript'));
158+
}, 600);
159+
}, 100)
160+
});
161+
</script>
162+
</head>
163+
<body no-js {{ bodyAttrs|raw }}>
164+
<div id="loading">
165+
<div class="messaging">
166+
<img src="{{ logo256x256 }}" alt="" loading="lazy" height="300px" width="300px" />
167+
<div class="progress-line"></div>
168+
<h1>Loading {{ title }}</h1>
169+
</div>
170+
</div>
171+
<haxcms-site-builder id="site" file="site.json"></haxcms-site-builder>
172+
<div id="haxcmsoutdatedfallback">
173+
<div id="haxcmsoutdatedfallbacksuperold">
174+
<iframe id="outline" style="width:18%;float:left;height:90vh;padding:0;margin:0;" name="outline" id="frame1"
175+
src="legacy-outline.html" loading="lazy"></iframe>
176+
<iframe id="content" style="width:80%;float:left;height:90vh;padding:0;margin:0;" name="content" id="frame2" src="" loading="lazy"></iframe>
177+
<div class="use-modern-browser">Please use a modern browser to
178+
view our website correctly. <a href="http://outdatedbrowser.com/">Update my browser now</a></div>
179+
</div>
180+
</div>
181+
<script>
182+
window.HAXCMSContext="published";
183+
document.body.removeAttribute('no-js');
184+
window.__appCDN="https://{{ cdn }}/";
185+
window.__appForceUpgrade={{ forceUpgrade }};
186+
</script>
187+
<script src="https://{{ cdn }}/build-haxcms.js"></script>
188+
<script src="https://{{ cdn }}/build.js"></script>
189+
</body>
190+
</html>

src/boilerplate/site/build-haxcms.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,18 @@ function haxcmsFallbackStylesError(e) {
9999
link.onerror = (e) => { haxcmsFallbackStylesError(e);};
100100
// if the module fails to load at the set CDN location, try to fail back to known sources
101101
if (cdn === "./") {
102-
// psu fallback
103-
haxCdn = "https://cdn.webcomponents.psu.edu/cdn/";
104-
link.href = haxCdn + baseResetStyles;
105-
linkDef.parentNode.insertBefore(link, linkDef);
106-
console.warn(cdn + " failed to respond, styles back to alternative: " + haxCdn);
102+
// hax cloud fallback
103+
haxCdn = "https://cdn.hax.cloud/cdn/";
104+
link.href = haxCdn + baseResetStyles;
105+
linkDef.parentNode.insertBefore(link, linkDef);
106+
console.warn(cdn + " failed to respond, styles back to alternative: " + haxCdn);
107+
}
108+
else if (cdn === "https://cdn.hax.cloud/cdn/") {
109+
// psu mirror
110+
haxCdn = "https://cdn.webcomponents.psu.edu/cdn/";
111+
link.href = haxCdn + baseResetStyles;
112+
linkDef.parentNode.insertBefore(link, linkDef);
113+
console.warn(cdn + " failed to respond, styles back to alternative: " + haxCdn);
107114
}
108115
else if (cdn === "https://cdn.webcomponents.psu.edu/cdn/") {
109116
// known mirror

src/boilerplate/site/build.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/public/assets/build.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/public/build-haxcms.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,18 @@ function haxcmsFallbackStylesError(e) {
9999
link.onerror = (e) => { haxcmsFallbackStylesError(e);};
100100
// if the module fails to load at the set CDN location, try to fail back to known sources
101101
if (cdn === "./") {
102-
// psu fallback
103-
haxCdn = "https://cdn.webcomponents.psu.edu/cdn/";
104-
link.href = haxCdn + baseResetStyles;
105-
linkDef.parentNode.insertBefore(link, linkDef);
106-
console.warn(cdn + " failed to respond, styles back to alternative: " + haxCdn);
102+
// hax cloud fallback
103+
haxCdn = "https://cdn.hax.cloud/cdn/";
104+
link.href = haxCdn + baseResetStyles;
105+
linkDef.parentNode.insertBefore(link, linkDef);
106+
console.warn(cdn + " failed to respond, styles back to alternative: " + haxCdn);
107+
}
108+
else if (cdn === "https://cdn.hax.cloud/cdn/") {
109+
// psu mirror
110+
haxCdn = "https://cdn.webcomponents.psu.edu/cdn/";
111+
link.href = haxCdn + baseResetStyles;
112+
linkDef.parentNode.insertBefore(link, linkDef);
113+
console.warn(cdn + " failed to respond, styles back to alternative: " + haxCdn);
107114
}
108115
else if (cdn === "https://cdn.webcomponents.psu.edu/cdn/") {
109116
// known mirror

0 commit comments

Comments
 (0)