forked from esmnext/esmx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenesis.dev.ts
More file actions
30 lines (27 loc) · 902 Bytes
/
genesis.dev.ts
File metadata and controls
30 lines (27 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { Watch } from '@fmfe/genesis-compiler';
import { Plugin, PostcssOptions } from '@fmfe/genesis-core';
import tailwindcss from 'tailwindcss';
import { app, RendererItems, ssr, startApp } from './genesis';
export class PostcssPlugin extends Plugin {
public postcss(config: PostcssOptions) {
config.postcssOptions.plugins.push(tailwindcss);
}
}
ssr.layout.plugin.use(PostcssPlugin);
const start = async () => {
const renderer: Partial<RendererItems> = {};
const watchArr = await Promise.all(
Object.keys(ssr).map(async (k) => {
const watch = new Watch(ssr[k]);
await watch.start();
renderer[k] = watch.renderer;
return watch;
})
);
watchArr.forEach((watch) => {
app.use(watch.devMiddleware);
app.use(watch.hotMiddleware);
});
startApp(renderer as RendererItems);
};
start();