Skip to content

Commit

Permalink
Fix: Get size of source map
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnitto committed Aug 1, 2021
1 parent e7ac784 commit 69aee43
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions postcss.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,15 @@ function css(css, file, time) {
if (result.map) {
const file = `${to}.map`;
const map = result.map.toString();
tasks.push(fs.outputFile(file, map));
if (!watch && index === 0) {
const size = fs.statSync(file)?.size;
mapFilesize = humanFileSize(size);
}
tasks.push(
fs.outputFile(file, map, () => {
if (!watch && index === 0) {
const size = fs.statSync(file)?.size;
mapFilesize = humanFileSize(size);
}
})
);

if (compression) {
tasks.push(writeGz(file, map));
tasks.push(writeBr(file, map));
Expand Down

0 comments on commit 69aee43

Please sign in to comment.