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”


Good to know @Donblanco! Thanks for sharing

1 Like

Many thanks @donblanco, I feel fortunate to have found this after only an hour of wild goose chases.

Suspect this will save quite a few folks for some time yet :+1:

1 Like

@Donblanco thank you so much for posting this, I was stuck down a rabbit hole until I found this.

1 Like

thanks for the awesome information.