Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

less compiler doubles everything

Tags:

css

less

I have a verry simple style.less file in my project, and i'm using bootstrap for a clean, responsive design. So here we go:

@import "bootstrap/bootstrap.less";

@import "../css/jquery.vegas.css";
@import "../css/jquery.fancybox-1.3.4.css";

body {
  padding-top: 60px;
  padding-bottom: 40px;
}

@import "bootstrap/responsive.less";

Now, when i compile the file with less, the css-output looks strange:

.container {
  width: 940px;
  margin-left: auto;
  margin-right: auto;
  *zoom: 1;
  *zoom: 1;
  width: 940px;
  margin-left: auto;
  margin-right: auto;
  *zoom: 1;
  *zoom: 1;
}

He's just doubling everything! I can see this odd behavior even in the browser directly when im working on my devolper instance.

That's so strange and awful, has anyone an idea why this is happening? In the original less-files that are imported from bootstrap, everything is defined only once.

like image 697
jebbie Avatar asked Mar 23 '12 13:03

jebbie


1 Answers

Here's two potential solutions. They both seem obvious, but I've overlooked BOTH of them at times...

  1. Are you seeing the duplicate style rules in the actual compiled css file? OR are you seeing duplicate rules in Firebug or Chrome's developer tools? If it's the second, go back and make sure your css file actually has duplicates.

  2. I had the exact same duplication problem while using LESS, and I couldn't figure it out until I realized that I'd included the css twice in the <head>. It's a silly mistake, but I've definitely done it before.

Good luck.

like image 160
emersonthis Avatar answered Oct 02 '22 22:10

emersonthis