Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Calle Bjernekull 28 posts 103 karma points
    Dec 13, 2016 @ 13:47
    Calle Bjernekull

    Minor bug in MinificationHelper

    I've found a bug in the MinificationHelper.IsMinified(string content) Proplem occurs if the checked content is minified to one single row. If the content is really minimized, it shouldn't contain '\n' at all, so the variable lines might get the value of 0 (zero). This will throw exception when trying to divide totalCharachters by zero

    public bool IsMinified(string content)
            var totalCharacters = content.Length;
            var lines = content.Count(x => x == '\n');
            var ratio = totalCharacters / lines;          // ratio characters per line
            return ratio < 200;
  • Mark Wemekamp 73 posts 385 karma points
    Dec 19, 2016 @ 16:24
    Mark Wemekamp

    Thanks, I've fixed the issue on github

    Should be in the next release I'm planning to release it this week

Please Sign in or register to post replies

Write your reply to: