Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

Commit

Permalink
manage multiple comment beginnings - fix #32
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarcia committed Apr 21, 2015
1 parent b28db37 commit 8f3dbe5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions uglifycss-lib.js
Expand Up @@ -277,22 +277,28 @@ function processString(content, options) {
c,
line = [],
lines = [],
vars = {};
vars = {},
partial;

options = options || defaultOptions;

content = extractDataUrls(content, preservedTokens);

// collect all comment blocks...
content = content.split("/*");
partial = "";
for (i = 0, c = content.length; i < c; ++i) {
endIndex = content[i].indexOf("*/");
if (endIndex > -1) {
comments.push(content[i].slice(0, endIndex));
comments.push(partial + content[i].slice(0, endIndex));
partial = "";
content[i] = "/*___PRESERVE_CANDIDATE_COMMENT_" + (comments.length - 1) + "___" + content[i].slice(endIndex);
} else if (i > 0) {
partial += content[i];
content[i] = "";
}
}
content = content.join("");
content = content.join("") + partial;

// preserve strings so their content doesn't get accidentally minified
pattern = /("([^\\"]|\\.|\\)*")|('([^\\']|\\.|\\)*')/g;
Expand Down

0 comments on commit 8f3dbe5

Please sign in to comment.