Minified CSS and Nunjucks

Just got a strange error when I minified my existing CSS:

“expected end of comment, got end of file”

Some searching pointed to nunjucks, but this issue comment zeroed in on the culprit:

tl;dr - if you have a media query, and the first element is an ID (#menu for example) when you minify it you will end up with “{#” together and nunjucks will interpret that as a comment opening. You probably don’t have any “#}” in your CSS, so it will see an unclosed comment and error out. Solution: add some other element in front of the ID - in my case “nav#menu”

1 Like

Good to know @Donblanco! Thanks for sharing

1 Like