Skip to content

Commit 305610b

Browse files
authored
Fix/tools/dev server sources (#2686)
* fix(tools): dev server load sources * fix(tools): dev server page styles
1 parent f538d08 commit 305610b

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

tools/pfe-tools/dev-server/demo.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ html, body {
2525
line-height: var(--pf-global--LineHeight--md, 1.5);
2626
text-align: left;
2727
background-color: var(--pf-global--BackgroundColor--100, #fff);
28+
min-height: 100vh;
2829
}
2930

3031
body {
31-
min-height: 100%;
3232
display: grid;
3333
grid-template-rows: var(--pf-demo-header-height, 4.375rem) auto;
3434
grid-template-columns: 100vw;

tools/pfe-tools/dev-server/plugins/pfe-dev-server.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,19 @@ function getRouter(options: PfeDevServerInternalConfig) {
123123
} else {
124124
return next();
125125
}
126+
})
127+
128+
.get(`/${elementsDir}/:element/:splatPath*.(css|js)`, async function(ctx, next) {
129+
ctx.response.etag = performance.now().toString();
130+
return next();
131+
})
132+
133+
// Redirect `elements/pf-jazz-hands/*.js` to `elements/pf-jazz-hands/*.ts` for requests not previously handled
134+
.get(`/${elementsDir}/:element/:splatPath*.js`, async ctx => {
135+
const { element, splatPath } = ctx.params;
136+
if (element.startsWith(tagPrefix) && !splatPath.includes('/')) {
137+
ctx.redirect(`/${elementsDir}/${element}/${splatPath}.ts`);
138+
}
126139
});
127140

128141
return router.routes();

0 commit comments

Comments
 (0)