Skip to content

Commit

Permalink
fix: prevent race condition when creating css files in build
Browse files Browse the repository at this point in the history
  • Loading branch information
nightwing committed Jul 21, 2022
1 parent f7432f5 commit 1777bfb
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Makefile.dryice.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,14 +450,21 @@ function buildAce(options, callback) {
if (options.noconflict && !options.compress)
buildTypes();

extractCss(options, function() {
if (callback)
return callback();
// call extractCss only once during a build
if (cssUpdated) {
console.log("Finished building " + getTargetDir(options));

});
return;
} else {
cssUpdated = true;
extractCss(options, function() {
if (callback)
return callback();
console.log("Finished building " + getTargetDir(options));
});
}
}
}
var cssUpdated = false;

function extractCss(options, callback) {
var dir = getTargetDir(options);
Expand Down Expand Up @@ -548,6 +555,7 @@ function extractCss(options, callback) {
imageCounter++;
var imageName = name + "-" + imageCounter + ".png";
images[imageName] = buffer;
console.log("url(\"" + directory + "/" + imageName + "\")");
return "url(\"" + directory + "/" + imageName + "\")";
}
);
Expand Down

0 comments on commit 1777bfb

Please sign in to comment.