madskristensen / WebEssentials2013

Visual Studio extension
http://vswebessentials.com
Other
944 stars 251 forks source link

Autoprefixer removig blank lines #1748

Open hydandata opened 9 years ago

hydandata commented 9 years ago

Selecting "Add Missing Standard Properties" or "Add Missing Vendor Specifics" from Web Essentials context menu causes empty lines to be removed from the containing definition, even when no changes are required. For example:

Before:

.row {
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;

    -ms-flex-wrap: wrap;
    flex-wrap: wrap;

    -ms-flex: 0 1 auto;
    flex: 0 1 auto;
}

After:

.row {
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;   
    -ms-flex: 0 1 auto;
    flex: 0 1 auto;
}
am11 commented 9 years ago

Note: Autoprefixer is the name of a node.js based service which WE kicks in when we compile Less or Sass files (given the respective option in WE Options > CSS is enabled) and Add missing .. et al. are WE's own commands/features.

The responsible code lives here: CssAddMissingStandardCommandTarget.cs#L65-L85, but more interestingly, there is another bug, that is; this condition should not be satisfied with your example in first place and hence overwrite the buffer (since your code already has all the vendor specifics). I think we need to revisit the visitor code. :)