NV / chrome-devtools-autosave

Auto-saving CSS and JavaScript changes from the Chrome Developer Tools
MIT License
1.05k stars 90 forks source link

Duplicating data #62

Closed serchavalos closed 8 years ago

serchavalos commented 12 years ago

There are some situations where the new version of the file is appended at the beginning of it, duplicating the content of it.

For example, after it saves the changes, the output of the file is:

/main.css /* New version/ body {background-color: black} / Old version*/ body {background-color: white}

Most likely this was occurred because I had the same CSS file opened in my editor (Sublime2 to be precise) causing these conflicts.

However, I think this case of having the editor opened and editing in the browser it's quite common (especially when adding new CSS class, a task current can't be done in Chrome Dev tool)

NV commented 12 years ago

I had exactly the same problem once with Sublime Text 2. I don’t yet understand how it happened, seams like Sublime didn’t reload the file from file system.

serchavalos commented 11 years ago

I don't think so. I have noticed that Sublime does load it properly. On the other hand, if you check the output in the console of autosave, you will see the new changes that have been submitted. When this process outputs/displays a lot of content (say, the whole CSS file), then you will notice that indeed the content of the CSS file has been duplicated.

I haven't looked at the code neither debug it but my guess is that somehow Sublime locks the file and, when autosave tries to read it, autosaves gets no content, thinks that this file is empty and put the whole new changed CSS file.

As soon as I have sometime, I'll try to prove this theory. In the meantime, what you can do is to pay attention to the console when using autosave in the browser and, when you see your whole CSS file there, go to the editor and delete the duplicated code.

trymbill commented 11 years ago

Had the same thing happen to me just now. Also using Sublime Text 2, but this only seems to be happening when I'm changing the CSS and I'm adding an attribute at the bottom of a clause.

trymbill commented 11 years ago

Just happened again without Sublime Text 2 even being open. I think this might have something to do with adding attributes since I haven't noticed this happening when I'm just changing attributes that are already there.

n4r-c0m commented 11 years ago

Same thing but I'm using PhpStorm istead of Sublime. Never had ever saw such behavior before, however I'm using Autosaver for several months.

The only thing I've noticed. This problem began to appear after I've added @import operator at the begin of the file.

NV commented 8 years ago

I haven't experienced this problem for a very long time. Closing.