};
}
+ var removeComments = function() {
+ replace(function stripComments() {
+ data = CleanCSS._stripComments(context, data);
+ });
+ };
+
// replace all escaped line breaks
replace(/\\(\r\n|\n)/mg, '');
- // strip comments one by one
- replace(function stripComments() {
- data = CleanCSS._stripComments(context, data);
- });
+ removeComments();
// inline all imports
replace(function inlineImports() {
});
});
+ // strip comments with inlined imports
+ if (data.indexOf('/*') > -1)
+ removeComments();
+
// strip parentheses in urls if possible (no spaces inside)
replace(/url\((['"])([^\)]+)['"]\)/g, function(match, quote, url) {
if (url.match(/[ \t]/g) !== null || url.indexOf('data:') === 0)
'inside a comment': [
'/* @import */a { color: red; }',
'a{color:red}'
+ ],
+ 'of a file with a comment': [
+ '@import url(test/data/partials/comment.css);',
+ ''
]
}),
'@import with absolute paths': cssContext({