MCPcopy Create free account
hub / github.com/angular/components / compileSassFiles

Function compileSassFiles

scripts/create-legacy-tests-bundle.mjs:84–106  ·  view source on GitHub ↗

* Compiles all non-partial Sass files in the project and writes them next * to their source files. The files are written into the source root as * this simplifies the resolution within the standalone Angular compiler. * * Given that the legacy tests should only run on CI, it is acceptable to *

()

Source from the content-addressed store, hash-verified

82 * explicitly added.
83 */
84async function compileSassFiles() {
85 const sassFiles = globSync('src/**/!(_*|theme).scss', {cwd: projectDir, absolute: true});
86 const writeTasks = [];
87
88 let count = 0;
89 for (const file of sassFiles) {
90 const outRelativePath = relative(projectDir, file).replace(/\.scss$/, '.css');
91 const outPath = join(projectDir, outRelativePath);
92 const content = renderSassFile(file).css;
93
94 count++;
95 console.error(`Compiled ${count}/${sassFiles.length} files`);
96
97 writeTasks.push(async () => {
98 console.info('Compiled, now writing:', outRelativePath);
99 await fs.promises.mkdir(dirname(outPath), {recursive: true});
100 await fs.promises.writeFile(outPath, content);
101 });
102 }
103
104 // Start all writes and wait for them to finish.
105 await Promise.all(writeTasks.map(task => task()));
106}
107
108/**
109 * Compiles the project using the Angular compiler in order to produce JS output of

Callers 1

mainFunction · 0.85

Calls 4

renderSassFileFunction · 0.85
errorMethod · 0.80
infoMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected