File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,6 @@ Deno.test("cli.ts build <entrypoint> --dist-dir <path> -- builds the site into g
1010 ) ;
1111 assertEquals (
1212 await Deno . readTextFile ( join ( tempdir , "index.html" ) ) ,
13- "<html><head></head><body><div>aaa</div>\n</body></html>" ,
13+ "<!DOCTYPE html>< html><head></head><body><div>aaa</div>\n</body></html>" ,
1414 ) ;
1515} ) ;
Original file line number Diff line number Diff line change @@ -147,6 +147,8 @@ type Asset = {
147147 createFileObject ( params : CreateFileObjectParams ) : Promise < File [ ] > ;
148148} ;
149149
150+ const docType = encoder . encode ( "<!DOCTYPE html>" ) ;
151+
150152/** HtmlAsset represents the html file */
151153class HtmlAsset implements Asset {
152154 static async create ( path : string ) : Promise < HtmlAsset > {
@@ -182,7 +184,7 @@ class HtmlAsset implements Asset {
182184
183185 createFileObject ( _params : CreateFileObjectParams ) {
184186 return Promise . resolve ( [ Object . assign (
185- new Blob ( [ encoder . encode ( this . #doc. body . parentElement ! . outerHTML ) ] ) ,
187+ new Blob ( [ docType , encoder . encode ( this . #doc. documentElement ! . outerHTML ) ] ) ,
186188 { name : this . #filename } ,
187189 ) ] ) ;
188190 }
Original file line number Diff line number Diff line change @@ -19,15 +19,15 @@ Deno.test("cli.ts serve <entrypoint> --port <port> --livereload-port <port> -- s
1919 let res = await fetch ( "http://localhost:4567/index.html" ) ;
2020 assertEquals (
2121 await res . text ( ) ,
22- `<html><head></head><body><div>aaa</div>\n<script src="http://localhost:34567/livereload.js"></script></body></html>` ,
22+ `<!DOCTYPE html>< html><head></head><body><div>aaa</div>\n<script src="http://localhost:34567/livereload.js"></script></body></html>` ,
2323 ) ;
2424
2525 // Non existent path returns the same response as the main html.
2626 // This is useful for apps which use client side routing.
2727 res = await fetch ( "http://localhost:4567/asdf" ) ;
2828 assertEquals (
2929 await res . text ( ) ,
30- `<html><head></head><body><div>aaa</div>\n<script src="http://localhost:34567/livereload.js"></script></body></html>` ,
30+ `<!DOCTYPE html>< html><head></head><body><div>aaa</div>\n<script src="http://localhost:34567/livereload.js"></script></body></html>` ,
3131 ) ;
3232 p . close ( ) ;
3333} ) ;
You can’t perform that action at this time.
0 commit comments