yogthos / lein-asset-minifier

Leiningen plugin for CSS/Js asset minifcation
Eclipse Public License 1.0
41 stars 7 forks source link

`watch` gets into some kind of loop #18

Open holyjak opened 6 years ago

holyjak commented 6 years ago

Hello! Thank you for this plugin!

However we experience one issue with it: it seems to get into a loop sometimes, minifying repeatedly even though the source file has not changed:

15:44:15 minify | minifying: screen.min.css
15:44:15 minify | assets: screen.css
15:44:15 minify | original size: 14630
15:44:15 minify | compressed size: 11681
15:44:15 minify | gzipped size: 2762
15:44:15 minify |
15:44:15 minify | minifying assets...
15:44:15 minify |
15:44:15 minify | minifying: screen.min.css
15:44:15 minify | assets: screen.css
15:44:15 minify | original size: 14630
15:44:15 minify | compressed size: 11681
15:44:15 minify | gzipped size: 2762
15:44:15 minify |
15:44:15 minify | minifying assets...
15:44:15 minify |
15:44:15 minify | minifying: screen.min.css
15:44:15 minify | assets: screen.css
15:44:15 minify | original size: 14630
15:44:15 minify | compressed size: 11681
15:44:15 minify | gzipped size: 2762

You see the input file size is unchanged. While this was running, I also confirmed its timestamp has not changed in the meantime:

🐟  ls -la resources/public/css/screen.css
-rw-r--r--  1 me  staff  14630 Sep 21 15:39 resources/public/css/screen.css
🐟  ls -la resources/public/css/screen.css
-rw-r--r--  1 me  staff  14630 Sep 21 15:39 resources/public/css/screen.css

Any idea what could be the issue?

Context

Config in project.clj:

:minify-assets [[:css {:source "resources/public/css/screen.css" :target "resources/public/css/screen.min.css"}]
                  [:css {:source "resources/public/css/print.css" :target "resources/public/css/print.min.css"}]
                  [:css {:source "resources/public/css/TeliaStyleguide/telia-styleguide.css" :target "resources/public/css/TeliaStyleguide/telia-styleguide.min.css"}]]

System:

Thank you!

yogthos commented 6 years ago

Thanks for the heads up. Not sure what causes the resources to be recompiled when the files haven't changed assuming this happens while watching for changes during development. The watcher logic is here.

If the recompilation happens when using a build hook that might be due to lein task being run multiple times.