Skip navigation
Currently Being Moderated

DW CS6 - How can I stop "Apply Source Formatting" from adding line breaks after my css comments?

Dec 11, 2012 9:58 AM

Tags: #bug #cs6 #code_formating

DW adds line breaks when I use the "apply source formatting" command in my css files. The css code formats corectly but after a css  /* comment */ - DW adds a line break every time I use the command so if I applies source formatting 10 times, I would get 10 empty lines after the comment.

 

BEFORE

 

 

/* --- Page Content  --- */

#page-content { margin: 0 auto; width: 100%; }

 

AFTER: css is ok but there is an extra line break after the comment.

 

 

/* --- Page Content  --- */


#page-content {
          margin: 0 auto;
          width: 100%;
}

 

APPLIED MULTIPLE TIMES: if I apply source formatting again for another rule, a line break is added after all css comments, so you start to add space throughout the file

 

 

/*  --- Main Content  --- */
/*---------------------------------------*/








#main-content { padding-bottom: 0; } 

/* --- Page Content  --- */








#page-content {
          margin: 0 auto;
          width: 100%;
}

 

 

How do I fix this? DW CS5 works fine

 
Replies
  • Sudarshan Thiagarajan
    4,000 posts
    Oct 15, 2010
    Currently Being Moderated
    Dec 11, 2012 10:07 AM   in reply to ethayer777

    Dreamweaver Preferences (Ctrl or Cmd + U) > Code Format > Advanced Formatting > CSS:

     

    cssline.jpg

     

    Disable the highlighted checkbox above to disable new lines being added.

     

    -ST

     
    |
    Mark as:
  • Sudarshan Thiagarajan
    4,000 posts
    Oct 15, 2010
    Currently Being Moderated
    Dec 11, 2012 10:25 AM   in reply to ethayer777

    Unfortunately, that is the way DW works. What you could do is file a bug report here: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform - it definitely is a bug - for DW to repeat the line break between comments each time source formatting is applied.

     

    In the meantime, leave 'Blank line between rules' enabled. Instead of applying source formatting to entire document if you change one bit of code in CSS, just make a selection of that code and Apply Source Formatting to Selection. That will get rid of the extra line between comments.

     

    -ST

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 11, 2012 11:42 AM   in reply to ethayer777

    I tried but could not reproduce this problem. I can see how this could be pretty annoying, so we'd like to investigate further to understand why you're encountering this problem.

     

    As as test, can I have you do the following?
    1. Close all files.

    2. Go to File > New.

    3. Select Blank Page, select HTML for the Page Type, then select HTML 5: 2-column fixed, select "Create New File" for the Layout CSS setting, and then click Create.

    4. In the source code for the CSS file, note the many comments in the CSS.

    5. Apply Source Formatting.

     

    Does the extra line(s) get added after the comments like was happening with your files?

     

    If not, then perhaps the cause has something to do with your specific files. If this is the case, I'd appreciate if you could send me one or more of these files.

     

    If it's happening with the Dreamweaver sample CSS as well, then something is going on with your copy of Dreamweaver. Let me know if so, and we'll go from there to get it resolved.

     
    |
    Mark as:
  • Sudarshan Thiagarajan
    4,000 posts
    Oct 15, 2010
    Currently Being Moderated
    Dec 11, 2012 12:11 PM   in reply to Carey Burgess

    Carey, I can confirm this is happening.

     

    Repeat same 5 steps that you had mentioned. Only difference being go into DW Prefs > Code Format > Advanced Formatting [CSS], enable 'Blank line between rules' as I had posted in my Reply #1.

     

    Now, each time you hit 'Apply Source Formatting' there is a new blank line that is created between rules. I think the algorithm doesn't check if a blank already exists, thereby adds one each time. In JS terms, conditional if else should work, which is not present at the moment

     

    -ST

     
    |
    Mark as:
  • Sudarshan Thiagarajan
    4,000 posts
    Oct 15, 2010
    Currently Being Moderated
    Dec 11, 2012 12:16 PM   in reply to ethayer777

    Ethayer, Carey is an Adobe employee (as you can see near his profile picture) whom I had requested to intervene here. He will have it escalated to wherever concerned.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 12, 2012 4:55 PM   in reply to ethayer777

    Thanks for submitting the bug report to the team. I am now able to reproduce the issue.

     

    I've flagged the issue for investigation, but as of now I would not expect a quick fix back from the team since it would be a low priority issue.

     

     

    This command (like all others) uses JavaScript to execute, so if you're familiar with JavaScript you might be able to modify it on your system to avoid this issue. This command runs from the file "Source Formatting.js" inside the Adobe Dreamweaver CS6\configuration\Commands folder.

     
    |
    Mark as:
  • Sudarshan Thiagarajan
    4,000 posts
    Oct 15, 2010
    Currently Being Moderated
    Dec 12, 2012 6:29 PM   in reply to Carey Burgess

    Thanks, Carey.

     

    I'm sure this will be fixed in the next major rollout?

     

    -ST

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points