Every line of 'normalize.css 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 };
75 export function hasRelativeUrls(css: string) { 76 CSS_URL_REGEXP.lastIndex = 0; 77 return CSS_URL_REGEXP.test(css); 78 }
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 }
24 function relativizeCSS (source, relativeRoot) { 25 return source.replace(/(url\(['"]?)\/(?!\/)/g, "$1"+relativeRoot); 26 }
31 function fixupCSSUrls(address, css) { 32 if (typeof css !== 'string') { 33 throw new Error("Failed loading required CSS file: " + address); 34 } 35 return css.replace(cssUrlMatcher, function (_, p1) { 36 var quote = p1.charAt(0); 37 if (quote === '\'' || quote === '"') { 38 p1 = p1.substr(1, p1.length - 2); 39 } 40 return 'url(\'' + relativeToFile(p1, address) + '\')'; 41 }); 42 }
397 function minifyCSSPackage(source) { //(String)->String 398 return cleanCss.process(source); 399 }
295 function fixPostcssUrl(url) { 296 return url.replace(/^http:\/+/, 'http://').replace(/^file:\/*/, 'file:///'); 297 }