MCPcopy
hub / github.com/webpack/webpack / css

Method css

test/helpers/FakeDocument.js:490–522  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

488 }
489
490 get css() {
491 if (this._css) return this._css;
492 let css = fs.readFileSync(
493 path.resolve(
494 this._basePath,
495 /** @type {string} */ (this._element.href)
496 .replace(/^https:\/\/test\.cases\/path\//, "")
497 .replace(/^https:\/\/example\.com\//, "")
498 .split("?")[0] // Remove query parameters (e.g., ?hmr=timestamp)
499 ),
500 "utf8"
501 );
502
503 css = css.replace(/@import url\("([^"]+)"\);/g, (match, url) => {
504 if (!/^https:\/\/test\.cases\/path\//.test(url)) {
505 return `@import url("${url}");`;
506 }
507
508 if (url.startsWith("#")) {
509 return url;
510 }
511
512 return fs.readFileSync(
513 path.resolve(
514 this._basePath,
515 url.replace(/^https:\/\/test\.cases\/path\//, "")
516 ),
517 "utf8"
518 );
519 });
520
521 return css;
522 }
523
524 get cssRules() {
525 if (this._cssRules) return this._cssRules;

Callers 5

requireMethod · 0.80
module.jsFile · 0.80
_bindClickEventsFunction · 0.80
_showTableInTableFunction · 0.80
showEnhanceEffectFunction · 0.80

Calls 4

splitMethod · 0.80
resolveMethod · 0.65
replaceMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected