Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes it hits the cache when the files are not on disk #264

Open
emirotin opened this issue Dec 5, 2021 · 0 comments
Open

Sometimes it hits the cache when the files are not on disk #264

emirotin opened this issue Dec 5, 2021 · 0 comments

Comments

@emirotin
Copy link

emirotin commented Dec 5, 2021

Hi

This tool is nice and convenient, thanks. But recently I started getting a very strange Shroedingbug.
Quite often if I clear the previously generated sprites and then run the build, it would report that the files were not changed, and skip writing them to disk. This ultimately leads to the build failure.
I wasn't able to reproduce it in debug mode, so it can be some kind of the race condition.

For now, I have commented these lines in my locally patched copy of the plugin:

diff --git a/node_modules/postcss-easysprites/lib/sprites.js b/node_modules/postcss-easysprites/lib/sprites.js
index c143a18..1ed7126 100644
--- a/node_modules/postcss-easysprites/lib/sprites.js
+++ b/node_modules/postcss-easysprites/lib/sprites.js
@@ -52,11 +52,11 @@ async function saveSpriteFile(spriteElement) {
   // Build the full path the sprite file should be saved to.
   sprite.path = path.resolve(opts.spritePath, `${sprite.groups}.png`);
 
-  // If the sprite is being pulled from the cache, don't save a new version.
-  if (sprite.isFromCache) {
-    log('Easysprites:', ansi.green(sprite.path), 'unchanged.');
-    return sprite;
-  }
+  // // If the sprite is being pulled from the cache, don't save a new version.
+  // if (sprite.isFromCache) {
+  //   log('Easysprites:', ansi.green(sprite.path), 'unchanged.');
+  //   return sprite;
+  // }
 
   // Save new version of the sprite image file.
   await writeFileAsync(sprite.path, Buffer.from(sprite.image, 'binary'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant