MCPcopy
hub / github.com/darkreader/darkreader / bundleCSSEntry

Function bundleCSSEntry

tasks/bundle-css.js:35–53  ·  view source on GitHub ↗
(entry, plus)

Source from the content-addressed store, hash-verified

33];
34
35async function bundleCSSEntry(entry, plus) {
36 const src = absolutePath(entry.src);
37 const srcDir = path.dirname(src);
38
39 let input = await readFile(src);
40 if (!plus) {
41 const startToken = '/* @plus-start */';
42 const endToken = '/* @plus-end */';
43 const startIndex = input.indexOf(startToken);
44 const endIndex = input.indexOf(endToken, startIndex);
45 if (startIndex >= 0 && endIndex >= 0) {
46 input = input.substring(0, startIndex) + input.substring(endIndex + endToken.length);
47 }
48 }
49
50 const output = await less.render(input, {paths: [srcDir], math: 'always'});
51 entry.watchFiles = output.imports;
52 return output.css;
53}
54
55async function writeFiles(dest, platforms, debug, css) {
56 const enabledPlatforms = Object.values(PLATFORM).filter((platform) => platform !== PLATFORM.API && platforms[platform]);

Callers 2

bundleCSSFunction · 0.85
onChangeFunction · 0.85

Calls 3

absolutePathFunction · 0.90
readFileFunction · 0.90
renderMethod · 0.65

Tested by

no test coverage detected