Blog

16 Oct
2012

Dreamweaver cc logo

How to remove blank lines in Dreamweaver


I was recently working on a website in Dreamweaver and had both PHP and CSS files with loads of blank lines of code, which needed to be deleted in order to make the files smaller.

So instead of doing it manually one at a time... which would have taken ages. I used a nice little tip in Dreamweaver.

1. Open the document you need to change.

2. Click CMD + F (Mac) or CTRL + F (PC).

3. In the Find and Replace window change the following:

Find in: to Current document

Search: to Source code

Find: input [\r\n]{2,}

Replace: input \n

Options: tick Use regular expression. It is slightly different in versions of cc 2016+ where you now need to choose the dropdown button on the top right - see the second picture below.

4. Finally select Replace All.

 CC 2015 and below

How to remove blank lines in Dreamweaver

 CC 2016 and above

How to remove blank lines in Dreamweaver CC

5. Optional - To make life easier just use the floppy disk icon to save the 'search and replace' settings for reference. Another tip: Make sure you also have 'current document' selected since it saves this setting as well.

Minor update for CC 2016+ the 'floppy disk save' is no longer available by default but can be activated by doing the following below options. IMPORTANT: You will need to edit this with another package other than Dreamweaver or you will keep loosing your changes.

 For Mac:

  1. Quit Dreamweaver
  2. Use finder to navigate to ~/Library/Preferences
  3. Open 'Adobe Dreamweaver CC [YOUR_VERSION] Prefs' using a text editor
  4. Find "[ADVANCED FIND AND REPLACE]" section and add "showhiddenoptions=TRUE"
[ADVANCED FIND AND REPLACE]
showhiddenoptions=TRUE
  1. Save and close the file
  2. Relaunch Dreamweaver

 For Windows:

  1. Quit Dreamweaver
  2. Open regedit
  3. Navigate to 'HKEY_CURRENT_USER\Software\Adobe\Dreamweaver CC [YOUR_VERSION]\Advanced Find And Replace'
  4. Add a string value "ShowHiddenOptions=TRUE"
ShowHiddenOptions=TRUE
  1. Close regedit
  2. Relaunch Dreamweaver

It should now appear again as below but with different icons for 'Save Query' and 'Load Query'.

Show Save Query and Load Query in Dreamweaver CC

Posted in: < PHP and HTML and CSS >
me@grafxflow avatar

me@grafxflow


I am a Full-stack Developer who also started delving into the world of UX/UI Design a few years back. I blog and tweet to hopefully share a little bit of knowledge that can help others around the web. Thanks for stopping by!

Visitors also viewed these posts

12 Thoughts

  1. 12 Sep
    2013

    avatar

    George

    Thanks a lot. This helped.
  2. 13 May
    2014

    avatar

    Marianne

    Thank you so much. Adobe DW6 has a bug that creates empty lines every time you format your code (CSS). I couldn't figure out how to remove those from a large style.css. This gem is going into my code library. :-)
  3. 15 May
    2014

    avatar

    me@grafxflow

    Always glad to help.
  4. 23 Jul
    2014

    avatar

    Jerry Schrader

    Thanks! Very helpful
  5. 08 Feb
    2015

    avatar

    Malik Mudassar

    Bring your cheek, I wanna kiss you mate.
  6. 09 Feb
    2015

    avatar

    me@grafxflow

    Glad to help!
  7. 12 Mar
    2015

    avatar

    Mark Law

    Thanks, this is saved me a huge amount of time!
  8. 30 Oct
    2015

    avatar

    Amin

    Give this guy a cookie.... Thanks ...
  9. 28 Mar
    2016

    avatar

    Surbhi Jain

    Thank you so much. it saved my lot's of time :) :) :)
  10. 16 May
    2016

    avatar

    Prasadh

    wonderful... saved me a lot of time :) :) :)

    thanks a ton....
  11. 13 Jun
    2018

    avatar

    Arvind Gondaliya

    Not proper work in js file.. Please infom me
  12. 13 Jun
    2018

    avatar

    me@grafxflow

    Hi Arvind,

    I have tested this in the latest version of Dreamweaver and it works fine, just a different way of choosing 'Use regular expression' but I have added a new screen shot.

    If this doesn't work can you go into more detail with what is happening?

Add comment

Add comment