diff --git a/vlib/vweb/tmpl/tmpl.v b/vlib/vweb/tmpl/tmpl.v
index f65749d6cb..17db759026 100644
--- a/vlib/vweb/tmpl/tmpl.v
+++ b/vlib/vweb/tmpl/tmpl.v
@@ -19,6 +19,13 @@ pub fn compile_file(path, fn_name string) string {
return compile_template(html, fn_name)
}
+enum State {
+ html
+ css // ' {
- // in_css = false
+ state = .html
+ }
+ else if line == '' {
+ state = .html
}
if line.contains('@if ') {
s.writeln(str_end)
@@ -74,23 +86,23 @@ pub fn compile_template(content, fn_name string) string {
}
s.writeln('for ' + line[pos + 4..] + '{')
s.writeln(str_start)
- } else if !in_css && line.contains('span.') && line.ends_with('{') {
+ } else if state == .html && line.contains('span.') && line.ends_with('{') {
// `span.header {` => `