But more annoyingly it will convert the following:
#div h1, #div h2, #div h3 {…}
into:
#div h1 {…}
#div h2 {…}
#div h3 {…}
Which significantly decreases the compiled CSS readability and
efficiency as well as the file size.
Is there a way around this, have a missed something?
#brochure-download h4, #hotel-info h4 {
background: @brandColourSecondary;
border-top: 4px solid #eaeaea;
}
Becomes:
#brochure-download h4 {
background: #cd9a3b;
border-top: 4px solid #eaeaea;
}
#hotel-info h4 {
background: #cd9a3b;
border-top: 4px solid #eaeaea;
}
This doesn't make sense at all to me.
Thanks.
From my experiences, the compiled CSS isn't supposed to be beautiful - that's why you're using LESS, no? Also, unless you have a single massive style sheet (which is a bad idea IMO) or you are really hurting / paranoid about file sizes, the expanded version of the CSS is not noticable.
--
You received this message because you are subscribed to the Google Groups "LESS - Leaner CSS" group.
To post to this group, send email to les...@googlegroups.com.
To unsubscribe from this group, send email to lesscss+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/lesscss?hl=en.
If you really want to reduce the size of the style sheet, try using a CSS minifier. There were links in a previous thread about this very thing. Search for it in the group page.
INPUT:
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p,
blockquote {
OUTPUT:
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p,
blockquote {
...but complex selectors have difficulties:
INPUT:
. #campusnav li, #campusnav a {
OUTPUT:
#campusnav li { float: left; }
#campusnav a { float: left; }
I agree with Ryan 100% about this being a big issue - it works against
the CSS best practice of combining redundant rules into multiple
selectors. In my stylesheets, LESS converts a 20+ selector declaration
with 5 properties (6 lines) into 20 declarations and 120 lines - not
so good.
It looks like the issue is selectors with more than one object. "body,
div#content, .sidebar" works fine, but "body, #content .sidebar"
splits into two declarations. Something about the process of
determining hierarchy seems to be causing this.
To me the ideology behind LESS is less, this just undermines reasons
to us LESS in the first place.
in my case it converts this:
input[type=text], input[type=password],
input.text, textarea, select, div.select {
...
:focus {
...
}
}
into this:
input[type=text] { ... }
input[type=text]:focus { .. }
input[type=password] { .. }
input[type=password]:focus { .. }
input.text { .. }
input.text:focus { .. }
textarea { ... }
textarea:focus { ... }
select { .. }
select:focus { ... }
div.select { ... }
div.select:focus { ... }
On Feb 17, 10:59 am, Stephen Lovell <stephen.ldesi...@gmail.com>
wrote:
I find LESS awesome, and perfectly coherent. If in the future it will
include a minifier, thats good of course. But that's just for time
reduction.
______________________________
Pier Paolo Ramon, www.memome.it
Projectmoon srl, projectmoon.pjoon.com
LESS is significantly bloating out clean CSS for no reason at all,
this
leads to more code and more for others without LESS to maintain in
the future... for no good reason.
Thanks,
Ryan
h1, h2, div#foo h1, div#foo h2{background: green;}
div h1, div h2 {background: red;}
p, div, code{background: blue;}
produces:
h1, h2 { background: green; }
div#foo h1 { background: green; }
div#foo h2 { background: green; }
div h1 { background: red; }
div h2 { background: red; }
p, div, code { background: blue; }
4 minutes into using LESS for the first time on a real project, I see
my hand crafted CSS that's written as:
#news h3, #contact h3, #bio h3, #elsewhere h3 {
font-family: Georgia, Times, serif;
font-size: 16px;
/* etc */
}
Turned into this by LESS:
#news h3 {
/* duplicated rules */
}
#contact h3 {
/* duplicated rules */
}
#bio h3 {
/* duplicated rules */
}
#elsewhere h3 {
/* duplicated rules */
}
/* etc */
For a project that's tag line is "Leaner CSS", I'm a bit confused by
this. The expansion in the output makes no sense to me. What's the
logic here? And I concur with others "minifiers will fix it" is not an
explanation as to why this is happening.
Is it a limitation of the parser / processor? Something that is going
to be addressed?
Ian
If you're this concerned about performance, you'd be doing both of
those and a bunch of other things too.
> Its not a limitation. The "less css" factor comes from WHAT YOU WRITE.
> Not what the browser reads. Use a minifier, gzip your static assets.
>
> If you're this concerned about performance, you'd be doing both of
> those and a bunch of other things too.
The point isn't performance, it's maintainability. Several people in this thread have already said that. We all know we can minify, g-zip, etc our CSS 'til it's squeaky fast.
LESS-generated CSS is hard to maintain. What if a client wants to tweak something themselves after you finish a project? That person will think better of you if the CSS you've delivered is as well-structured as the LESS you started with.
This isn't a deal-breaker for me; I still love LESS and use it often. I don't know enough Ruby to offer a patch.
r
I understand the points you (and others are making) entirely, the
actual CSS output by less is far from efficient.
There don't seem to be any tools that can do a decent job (I admit
it's been a looong time since I've looked) of combining css well eg
#foo a {
margin: 1em;
}
#bar a {
margin: 1em;
}
to
#foo a, #bar a {
margin: 1em;
}
For a case as simple as that there probably are tools but there comes
a point when using complex CSS selectors that combining them
inevitably changes the order they're declared in and/or specificity,
so the CSS rules that come out differ to what was originally intended.
I suspect it's for this reason that the developers chose to keep the
output simple but verbose, I'd rather have verbose CSS output that
works than elegant buggy output. I'd still love to see better output
though, but I'm not holding my breath.
I always check in/upload .less files to the same place as the .css so
hopefully if clients want to make changes in the future they find
them, a quick google search should tell them what they're for.
This is most definitely a bug, and one that really should be looked at
ASAP.