Visual Studio (2012 and lower) deletes CSS properties
Okay I found a temporary workaround for this:
The existence of the "filter:" style is what's causing all of the "background-image:" styles to disappear except the last one listed. It's not that it's removing what it doesn't know, it's just removing all but the last "background-image" style listed. Must be Microsoft (intended) way of making filter and an MS specific background-image style play nicely together, however they didn't code it up very well. Definitely a MS VS defect. To repro, just right click in the CSS class that has code similar to this:
background-color: #EBEBEB; /* Fallback background color for non supported browsers */
background-image: -webkit-gradient(linear, left top, right top, from(#FFFFFF), to(#DAD6E7));
background-image: -webkit-linear-gradient(left, #FFFFFF, #DAD6E7);
background-image: -moz-linear-gradient(left, #FFFFFF, #DAD6E7);
background-image: -ms-linear-gradient(left, #FFFFFF, #DAD6E7);
background-image: -o-linear-gradient(left, #FFFFFF, #DAD6E7);
background-image: linear-gradient(left, #FFFFFF, #DAD6E7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#FFFFFF', EndColorStr='#DAD6E7', gradientType='1'); /* IE6 - IE9 */
and then select "Build Style...". Then click "OK" without changing anything and watch it remove all but the last background-image left. Try changing the order of the "background-image styles and leave webkit last and then see for yourself.
You'll notice that if you remove the "filter:" style the problem goes away, however we need that (for this example) so the solution seems to be moving the "filter:" style above all the "background-image:" lines. Once you do that, it leaves them alone and the problem goes away.
Changing the above CSS to this seems to aleviate the problem:
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#FFFFFF', EndColorStr='#DAD6E7', gradientType='1'); /* IE6 - IE9 */
background-color: #EBEBEB; /* Fallback background color for non supported browsers */
background-image: -webkit-gradient(linear, left top, right top, from(#FFFFFF), to(#DAD6E7));
background-image: -webkit-linear-gradient(left, #FFFFFF, #DAD6E7);
background-image: -moz-linear-gradient(left, #FFFFFF, #DAD6E7);
background-image: -ms-linear-gradient(left, #FFFFFF, #DAD6E7);
background-image: -o-linear-gradient(left, #FFFFFF, #DAD6E7);
background-image: linear-gradient(left, #FFFFFF, #DAD6E7);
UPDATE:
The workaround above only works for when VS applies formatting when you're using the "Build Style..." --> "Modify Style" dialog because I just saw it again with the fix above in place so it must be from somthing else.
How can I get .less compiler support in Visual Studio 2012 Release 2?
Visual studio doesn't have an auto-compilation feature for less files. It only provides syntax-highlighting for .less files.
You can compile your LESS files using a plugin like Web Workbench or Web Essentials 2012
how can I compile less files
I used a different approuch, I did make use of Web Essentials
for every theme i created a file themex.less where I
- import main variables (this is not in main file because of error with webessentials)
- import main file
- import theme variables which ovverrides the main variables
thats it, pretty simple and straightforward.
How to make Visual Studio stop compiling .js and .css files
Enter the options through
Tools > Options
If it isn't checked, check the "Show all settings" box at the bottom of that window.
In the tree to the left, choose:
Text Editor > CSS > CSS Specific
Uncheck "Detect Errors". Then, choose:
Text Editor > JScript > Miscellaneous
Uncheck "Show syntax errors".
You can also change how it indents each type of code too, in the various settings in those "Text Editor" sub-options.
Can Visual Studio 2013 generate CSS files from .less files?
Yes. While Visual Studio 2013 doesn't come with a LESS compiler built-in (so you'll need to bring your own), you can either use an external compiler, or install an extension so you can compile your LESS files from within the IDE.
Related Topics
Yet Another HTML/CSS Layout Challenge - Full Height Sidebar with Sticky Footer
No Video with Supported Format and Mime Type Found. What Does This Mean and How to Change This
Where Is The Visual Studio HTML Designer
How Could I Play a Shoutcast/Icecast Stream Using HTML5
Automatic Retina Images for Web Sites
Scale Svg to Container Without Mask/Crop
HTML Form File Uploads Doesn't Upload File
Adjusting and Image Size to Fit a Div with Bootstrap
Flexbox Not Working in Internet Explorer 11
Difference Between HTML and Dom
Trying to Center Div Horizontally and Vertically in Screen
How to Make a Div 100% of Page (Not Screen) Height
Assign Variables to Child Template in {% Include %} Tag Django
W3C Markup Validator Ampersand (&) Error
How to Make The HTML Link Activated by Clicking on The <Li>
How to Make Rounded Border in Ie8 with CSS
Pure CSS 3 Image Slider - Without JavaScript or Radio Inputs