"Unclosed comment" Twig error when including CSS file
Created 8 years ago by samharrison7

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 { and #title together, forming the start of a Twig comment {#. The quick hack in my case was to just put div before #title, but I'm wondering why the CSS is being compiled as a .twig file? The offending CSS file was included using {{ asset_style("app.css") }}

ryanthompson  —  8 years 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  —  8 years ago

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