Copy link to clipboard
Copied
I am using the most current Dreamweaver.
I have code with a many blank lines. How can I remove them? The old solutions online do not work.
I have tried this regular expression:
^(?:[\t ]*(?:\r?\n|\r))+
It works but does not work using "Replace All" so I have to hit enter 200-500 time for each php file.
Any solutions would be appreciated!
Assuming you've set your Code Format Settings and gone through each tag with your Tag Library Editor, clicking Apply Source Formatting (the paint bucket icon on the Common Toolbar) might clean up some of the unwanted spaces for you. See screenshots.
Copy link to clipboard
Copied
Example :up_arrow:
How I want it to look:
Copy link to clipboard
Copied
What types of tools have you tried online? A thought I am having is if you minify the code, and use a tool to unminify I'm wondering if those spaces would be removed in that process.
Copy link to clipboard
Copied
I haven't tried any to minify. My hope is I can do this in Dreamweaver. Apparently this used to work but doesn't in later versions of Dreamweaver.
Open the file
Click CTRL + F
Select "Current document" in "Find in" (You can also select the folder if you have multiple files)
Search in "Source code"
Tick "Use regular expression"
Type "[\r\n]{2,}" (without quotes) in "Find"
Type "\n" (without quotes) in "Replace"
Press "Replace All"
//This removes all blank lines in Dreamweaver.
//Make sure to untick regular expression afterwards!
Copy link to clipboard
Copied
Use Code Minify.
https://codebeautify.org/minify-html
Copy link to clipboard
Copied
Assuming you've set your Code Format Settings and gone through each tag with your Tag Library Editor, clicking Apply Source Formatting (the paint bucket icon on the Common Toolbar) might clean up some of the unwanted spaces for you. See screenshots.
Copy link to clipboard
Copied
Thank you everyone for your reponses but this worked for me perfectly! I can't belive I didn't know this existed.
Copy link to clipboard
Copied
By @SchmonkeeI haven't tried any to minify. My hope is I can do this in Dreamweaver. Apparently this used to work but doesn't in later versions of Dreamweaver.
Try testing with the following expression set:
place in the search field
(>)\s+|\s+(?=<)
and, in the replacement field
$1
Find more inspiration, events, and resources on the new Adobe Community
Explore Now