File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 4545 let data = bytes . compare ( Buffer . from ( string ) ) === 0 ? string : [ ...bytes ] ;
4646
4747 if ( path . endsWith ( 'routes/+page.svelte' ) ) {
48- data = `<script>\nimport App from './App.svelte';\n</script>\n\n<App />\n` ;
48+ data = `<script>\n\timport '../app.css';\n\timport App from './App.svelte';\n</script>\n\n<App />\n` ;
4949 }
5050
5151 files . push ( { path : path . slice ( output_dir . length + 1 ) , data } ) ;
6060 'export const ssr = false;\n'
6161 } ) ;
6262
63+ // add CSS styles from playground to the project
64+ const html = readFileSync (
65+ join ( output_dir , '../../../../packages/repl/src/lib/Output/srcdoc/index.html' ) ,
66+ { encoding : 'utf-8' }
67+ ) ;
68+ const css = html
69+ . slice ( html . indexOf ( '<style>' ) + 7 , html . indexOf ( '</style>' ) )
70+ . split ( '\n' )
71+ . map ( ( line ) =>
72+ // remove leading \t
73+ line . slice ( 3 )
74+ )
75+ . join ( '\n' )
76+ . trimStart ( ) ;
77+ files . push ( {
78+ path : 'src/app.css' ,
79+ data : css
80+ } ) ;
81+
6382 writeFileSync ( output_file , JSON . stringify ( files ) ) ;
6483
6584 // remove output dir afterwards to prevent it messing with Vite watcher
You can’t perform that action at this time.
0 commit comments