How to remove unwanted “extra line breaks” that appear in PHP/CSS/JS files after unzip?

好久不见. 提交于 2019-12-11 16:42:17

问题


Consider the following:

  • Zip up a folder, upload to server
  • unzip on server using 'unzip archive.zip'
  • Download any PHP file from that folder
  • Extra line breaks appear where unwanted

Any ideas why this happens or how to "undo it"? I have tried to do a "find and replace" but that ends up basically minifying the entire file onto "1 line", which is not wanted either...

Examine the attached image here


回答1:


For the sake of posterity: I found that I was able to use this tactic: https://pixelflips.com/blog/removing-line-breaks-in-dreamweaver

  • Open the Find/Replace box (CMD+F / CTRL+F)
  • In the Find enter: [\r\n]{2,}
  • In the Replace enter: \n
  • Check the box "Use regular expression" and un-check any other boxes.
  • The hit "Replace All"

By using Adobe Dreamweaver, which works...

However, I am not going to make my own answer correct as I still wonder why this happens and want to prevent it if possible.



来源:https://stackoverflow.com/questions/56570846/how-to-remove-unwanted-extra-line-breaks-that-appear-in-php-css-js-files-after

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!