diff --git a/examples/vweb/index.html b/examples/vweb/index.html new file mode 100644 index 0000000000..4c3420f04d --- /dev/null +++ b/examples/vweb/index.html @@ -0,0 +1 @@ +test app diff --git a/vlib/vweb/tmpl/tmpl.v b/vlib/vweb/tmpl/tmpl.v index 152a711fc4..f229944318 100644 --- a/vlib/vweb/tmpl/tmpl.v +++ b/vlib/vweb/tmpl/tmpl.v @@ -35,14 +35,14 @@ _ := header //footer := \'footer\' ') s.writeln(STR_START) - mut in_css := false + mut in_css :=true// false for _line in lines { line := _line.trim_space() if line == '' { - in_css = false + //in_css = false } if line.contains('@if ') { s.writeln(STR_END) diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 7db2280735..abf8abe4a2 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -181,24 +181,24 @@ fn (ctx mut Context) parse_form(s string) { } } } +const ( + mime_types = { + '.css': 'text/css; charset=utf-8', + '.gif': 'image/gif', + '.htm': 'text/html; charset=utf-8', + '.html': 'text/html; charset=utf-8', + '.jpg': 'image/jpeg', + '.js': 'application/javascript', + '.wasm': 'application/wasm', + '.pdf': 'application/pdf', + '.png': 'image/png', + '.svg': 'image/svg+xml', + '.xml': 'text/xml; charset=utf-8' + } +) fn (ctx mut Context) scan_static_directory(directory_path, mount_path string) { - // mime types - mut mime_types := map[string]string{} - mime_types['.css'] = 'text/css; charset=utf-8' - mime_types['.gif'] = 'image/gif' - mime_types['.htm'] = 'text/html; charset=utf-8' - mime_types['.html'] = 'text/html; charset=utf-8' - mime_types['.jpg'] = 'image/jpeg' - mime_types['.js'] = 'application/javascript' - mime_types['.wasm'] = 'application/wasm' - mime_types['.pdf'] = 'application/pdf' - mime_types['.png'] = 'image/png' - mime_types['.svg'] = 'image/svg+xml' - mime_types['.xml'] = 'text/xml; charset=utf-8' - files := os.ls(directory_path) - if files.len > 0 { for file in files { mut ext := ''