Trailing directives break groundskeeper
betaorbust opened this issue · comments
Jacques Favreau commented
Currently, groundskeeper just matches on /^[<]([/]([^\s])[>]$/ for any pragma and then does an every-other pass to decide what to strip out. If there's a trailing open directive, everything breaks because of the while(ranges.length)
block calling ranges.shift twice.
console.log('keep me!');
if(foo){
//<pragma>
console.log('oops!');
}
Causes
turns into:
console.log('keep me!');
if(foo){
The fix will be to just change it to while(ranges.length > 1)
and ignore the broken pragmas.