Every line of 'css normalize cdn' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
4 function cleanCss(css) { 5 this.cacheable(); 6 7 var loader = this; 8 var callback = this.async(); 9 10 new CleanCSS().minify(css, function (err, minified) { 11 if (err) { 12 if (Array.isArray(err) && (err[0] !== null)) { 13 return callback(err[0]); 14 } else { 15 return callback(err); 16 } 17 } 18 var warnings; 19 if (((warnings = minified.warnings) !== null ? warnings.length : void 0) !== 0) { 20 warnings.forEach(function (msg) { 21 loader.emitWarning(msg.toString()); 22 }); 23 } 24 25 return callback(null, minified.styles, minified.sourceMap); 26 }); 27 };
84 function compress(css){ 85 return css.replace(/\s+|\n/g, " ") //压缩空格和换行 86 .replace(/\/\*(\n|.)*?\*\//g, "") //去掉/**/注释 87 .replace(/\s*{\s*/g, "{") //去掉{ }括号两旁的空格 88 .replace(/\s*}\s*/g, "}") 89 .replace(/\s*:\s*/g, ":") //去掉 : 冒号两旁的空格 90 .replace(/\s*;\s*/g, ";") //去掉 ; 分号两旁的空格 91 .replace(/\s*,\s*/g, ","); //去掉 , 逗号两旁的空格 92 }
75 export function hasRelativeUrls(css: string) { 76 CSS_URL_REGEXP.lastIndex = 0; 77 return CSS_URL_REGEXP.test(css); 78 }
152 function isCSS(path, data) { 153 // If file unsaved, there's no good way to determine whether or not it's 154 // CSS based on the file contents. 155 if (path == "?") { 156 return false; 157 } 158 return isTypeAllowed("css", path); 159 }
295 function fixPostcssUrl(url) { 296 return url.replace(/^http:\/+/, 'http://').replace(/^file:\/*/, 'file:///'); 297 }
20 function _cleanInlineCSS(inlineCSS, toRemove){ 21 var inlineCSSArray = inlineCSS.split(';'); 22 var toRemoveArray = toRemove.split(' '); 23 24 var cleaned = ''; 25 var keep; 26 27 for (var i = 0, j = inlineCSSArray.length; i < j; i++) { 28 keep = true; 29 for (var a = 0, b = toRemoveArray.length; a < b; a++) { 30 if (inlineCSSArray[i] === '' || inlineCSSArray[i].indexOf(toRemoveArray[a]) !== -1) { 31 keep = false; 32 } 33 } 34 if(keep) {cleaned += inlineCSSArray[i] + '; ';} 35 } 36 37 return cleaned; 38 }