I'm using an Apache server to serve websites for web development. That way i'm constantly saving and editing files.
I'm using Gulp for Sass and to concat and uglify css and js files.
A month ago i'm experiencing problems with my js and css files. It seems that there are randomly generated '\u0' characters added below the files.
These characters are not visible in the code editor only in the browser inspect:
Chrome says: SyntaxError: Invalid or unexpected token Firefox says: 'SyntaxError: illegal character'
I can see the characters also when opening CSS/SCSS files. CSS is forgiving and keeps working. JS stops working when the characters are added.
The problem never happens when a file is empty. But if there is only when simple line of code (for example: console.log('test');
) the problem can occur.
My first bet was here: No visible cause for "Unexpected token ILLEGAL" Although i could successfully change the apache config the problem would still persist.
I have no idea if this is a Gulp related issue or a Apache related issue. Even the gulpfile.js itself sometimes has these hidden characters added. So it's probably not related to gulp?
I found a way to create files without the hidden characters. First I have to delete the content of the file entirely. Then save it. Then add the lines I wanted to create. Only the very first time when saving this will work. When i save again, the hidden characters are added again.
Sounds like a cache problem i thought. But i tried everything from disabling cache in apache to removing all cache from browser. Nothing seems to work.
Help me internet, you are my only hope.
update: After some more trial and error i decided to change from SMB to AFP. This seems to help.