Mount JSX server side templating for blog posts. Send AppShell conditionally. Maintain support for HMR via HTMLbundles using Bun's native fullstack dev server under an /hmr path. This is only mounted in development and is supported by the onImport Bun plugin. Add DB creation on startup and load pages based on those records.
18 lines
585 B
TypeScript
18 lines
585 B
TypeScript
// Minify CSS using simple but effective regex
|
|
export function minifyCSS(css: string): string {
|
|
return css
|
|
.replace(/\/\*[\s\S]*?\*\//g, '') // Remove comments
|
|
.replace(/\s+/g, ' ') // Collapse whitespace
|
|
.replace(/\s*([{}:;,])\s*/g, '$1') // Remove space around delimiters
|
|
.trim();
|
|
}
|
|
|
|
// Minify TypeScript/JavaScript code for client-side injection
|
|
export function minifyJS(code: string): string {
|
|
const transpiler = new Bun.Transpiler({
|
|
loader: 'ts',
|
|
minifyWhitespace: true,
|
|
});
|
|
|
|
return transpiler.transformSync(code);
|
|
} |