"Unclosed comment" Twig error when including CSS file

samharrison7 - 6 months ago

Anyone had an "unclosed comment" Twig error from the rendering of a CSS file before? It's happening because I've got a media query whose first component is referenced by an id, e.g.:

@media screen and (min-width: 45em) {
  #title { }

Obviously when this compiles you end up with the @media screen and (min-width: 45em) { #title { } } and { together, forming the start of a Twig comment #title. The quick hack in my case was to just put {# before div, but I'm wondering why the CSS is being compiled as a .twig file? The offending CSS file was included using #title

ryanthompson - 6 months ago

I have seen this yes. Maybe add a space or something. Not sure how to fix that one at the moment. Ill have to track down where exactly it's parsing it - I would assume the end before the writing to cache file.

samharrison7 - 6 months ago

Yeah, it's not a huge issue and easily avoided! Was just curious if anyone else had come across it.