1
0
mirror of https://github.com/locomotivemtl/locomotive-boilerplate.git synced 2026-01-15 00:55:08 +08:00

Apply suggestions from code review

Co-authored-by: Chauncey McAskill <chauncey@mcaskill.ca>
This commit is contained in:
Deven Caron
2022-04-11 15:57:18 -04:00
parent 4fafcb8e1d
commit d6193a41fa
2 changed files with 11 additions and 18 deletions

View File

@@ -144,8 +144,8 @@ export default async function compileStyles(sassOptions = null, postcssOptions =
try {
await writeFile(outfile, result.css).then(() => {
//Purge css once file exists.
purgeUnusedCSS(outfile, filestem);
// Purge CSS once file exists.
purgeUnusedCSS(outfile, `${label || `${filestem}.css`}`);
});
if (result.css) {
@@ -222,14 +222,10 @@ function createPostCSSProcessor(pluginsListOrMap, options)
*
* @async
*
* @param {string} [outfile=false] - The path of a css file
* If missing the function stops.
* @param {string} text - The file name.
* @param {string} outfile - The path of the CSS file.
* @param {string} filestem - The CSS file name.
*/
async function purgeUnusedCSS(outfile = false, filestem) {
if(!outfile) {
return;
}
const timeLabel = `${filestem}.css purged in`;
console.time(timeLabel);