Skip to content

Commit 9c00d5b

Browse files
committed
url-spec, web-routes, content: static subdirectories
1 parent dc318c6 commit 9c00d5b

13 files changed

+53
-23
lines changed

src/content/dependencies/generatePageLayout.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ export default {
596596

597597
html.tag('link', {
598598
rel: 'stylesheet',
599-
href: to('static.path', 'site.css'),
599+
href: to('staticCSS.path', 'site.css'),
600600
}),
601601

602602
html.tag('style', [
@@ -606,7 +606,7 @@ export default {
606606
]),
607607

608608
html.tag('script', {
609-
src: to('static.path', 'lazy-loading.js'),
609+
src: to('staticJS.path', 'lazy-loading.js'),
610610
}),
611611
]),
612612

@@ -636,7 +636,7 @@ export default {
636636

637637
html.tag('script', {
638638
type: 'module',
639-
src: to('static.path', 'client.js'),
639+
src: to('staticJS.path', 'client.js'),
640640
}),
641641
]),
642642
])

src/content/dependencies/image.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export default {
170170
if (willReveal) {
171171
reveal = [
172172
html.tag('img', {class: 'reveal-symbol'},
173-
{src: to('static.path', 'warning.svg')}),
173+
{src: to('staticMisc.icon', 'warning.svg')}),
174174

175175
html.tag('br'),
176176

src/content/dependencies/linkExternalAsIcon.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default {
3737
html.tag('title', platformText),
3838

3939
html.tag('use', {
40-
href: to('static.icon', iconId),
40+
href: to('staticMisc.icon', iconId),
4141
}),
4242
]),
4343

File renamed without changes.
File renamed without changes.

src/static/client.js src/static/js/client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// ephemeral nature.
77

88
import {accumulateSum, empty, filterMultipleArrays, stitchArrays}
9-
from '../util/sugar.js';
9+
from '../shared-util/sugar.js';
1010
import {fetchWithProgress} from './xhr-util.js';
1111

1212
const clientInfo = window.hsmusicClientInfo = Object.create(null);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/static/shared-util/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# `src/static/shared-util`
2+
3+
Module imports under `src/static/js` may appear to be pointing to files that aren't at quite the right place. For example, the import:
4+
5+
import {empty} from '../shared-util/sugar.js';
6+
7+
...is reading a file that doesn't exist here, under `shared-util`. This isn't an error!
8+
9+
This folder (`src/shared-util`) does not actually exist in a build of the website; instead, the folder `src/util` is symlinked in its place. So, all files under `src/util` are actually available at `/shared-util/` online.
10+
11+
The above import would actually import from the bindings in `src/util/sugar.js`.

src/url-spec.js

+23-14
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,29 @@ const urlSpec = {
6666
paths: genericPaths,
6767
},
6868

69+
staticCSS: {
70+
prefix: 'static/css/',
71+
paths: genericPaths,
72+
},
73+
74+
staticJS: {
75+
prefix: 'static/js/',
76+
paths: genericPaths,
77+
},
78+
79+
staticMisc: {
80+
prefix: 'static/misc/',
81+
paths: {
82+
...genericPaths,
83+
icon: 'icons.svg#icon-<>',
84+
},
85+
},
86+
87+
staticSharedUtil: {
88+
prefix: 'static/shared-util/',
89+
paths: genericPaths,
90+
},
91+
6992
media: {
7093
prefix: 'media/',
7194

@@ -89,20 +112,6 @@ const urlSpec = {
89112
prefix: 'thumb/',
90113
paths: genericPaths,
91114
},
92-
93-
static: {
94-
prefix: 'static/',
95-
paths: {
96-
...genericPaths,
97-
98-
icon: 'icons.svg#icon-<>',
99-
},
100-
},
101-
102-
util: {
103-
prefix: 'util/',
104-
paths: genericPaths,
105-
},
106115
};
107116

108117
// This gets automatically switched in place when working from a baseDirectory,

src/web-routes.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,23 @@ function getNodeDependencyRootPath(dependencyName) {
1616

1717
export const stationaryCodeRoutes = [
1818
{
19-
from: path.join(codeSrcPath, 'static'),
20-
to: ['static.root'],
19+
from: path.join(codeSrcPath, 'static', 'css'),
20+
to: ['staticCSS.root'],
21+
},
22+
23+
{
24+
from: path.join(codeSrcPath, 'static', 'js'),
25+
to: ['staticJS.root'],
26+
},
27+
28+
{
29+
from: path.join(codeSrcPath, 'static', 'misc'),
30+
to: ['staticMisc.root'],
2131
},
2232

2333
{
2434
from: path.join(codeSrcPath, 'util'),
25-
to: ['util.root'],
35+
to: ['staticSharedUtil.root'],
2636
},
2737
];
2838

0 commit comments

Comments
 (0)