simplifyify icon indicating copy to clipboard operation
simplifyify copied to clipboard

Compatibility with Browsersync

Open mdmoreau opened this issue 6 years ago • 2 comments

First off, thanks for the great tool!

I'm having an issue when using Browsersync watch/reload with simplifyify. Here is the npm script I'm using.

simplifyify js/main.js -m -d -w -o js/main.min.js

Browsersync is watching for changes to js/main.min.js and reloading at the correct time. The problem I'm seeing is that after automatic reload there doesn't seem to be any js/main.min.js file on the page. I took a look in Chrome dev tools sources and there's no such file there at all. However after reloading the page manually via the browser, the JS file is loaded correctly.

Does simplifyify modify the output file multiple times? It seems like Browsersync is picking up on the change too early if that's the case. I even tried adding a reloadDebounce to Browsersync, but the results were inconsistent - the automatic reload only worked correctly sometimes. My guess is that with a high enough value it might fix the problem, but ideally I'd like to keep the delay at 0.

Would appreciate any insight you have here. Thanks!

mdmoreau avatar Aug 21 '17 15:08 mdmoreau

Interesting. I've never used Browsersync, so I'm not sure what the issue here is. My hunch is that it's related to this block of code, which I added a while back as a workaround for a similar timing issue

JamesMessinger avatar Aug 22 '17 04:08 JamesMessinger

Thanks for getting back to me so quickly. For some reason I can't duplicate the issue anymore on the current project. When I get a chance I'm going to set something up with the original problem files and see if it happens again then. Assuming it does I'll try editing that block of code you mentioned to see if it helps.

Do you happen to have an example of the previous timing issue you mentioned? Would be happy to see if that's something that can be sorted out alongside those edits. Ideally it seems like we'd want to get rid of the setTimeout since that timing could vary between machines.

mdmoreau avatar Aug 23 '17 13:08 mdmoreau