Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Duplicate definitions
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
jo...@pdms.com  
View profile  
 More options Feb 9, 4:52 am
From: jo...@pdms.com
Date: Thu, 9 Feb 2012 01:52:48 -0800 (PST)
Local: Thurs, Feb 9 2012 4:52 am
Subject: Duplicate definitions
Hello,

I've been using dot less for a while and it's really transformed how I
write CSS for the better - in particular in these days of CSS3 and
multiple ways of doing the same thing for different browsers.

However, I've found that dot less will sometimes duplicate rules if a
file is imported by more than one other file.  It's probably easier
for me to explain by example.

I have split out the CSS for my site into different chunks - layout,
content and then specific other bits and bobs.  I then have a single
file that combines them all together.  I also have a helper file with
mixins to help with things like CSS3 etc.

So in my test, my default.less file looks like this:

@import "layout.less";
@import "content.less";

layout.less is this:

@import "mixins.less";
body
{
        border: 5px solid #000;
        .curves(10px);

}

content.less is:

@import "mixins.less";
.content
{
        border: 3px solid red;
        .curves(4px);

}

And mixins.less is:

.curves(@radius)
{
        border-radius: @radius;

}

When I browse to default.less I get this:

body {
  border: 5px solid #000;
  border-radius: 10px;
  border-radius: 10px;

}

.content {
  border: 3px solid red;
  border-radius: 4px;
  border-radius: 4px;

}

It seems it doubles-up the rules from mixins.less each time it is
imported in.

I realise I can change it so that "default.less" imports in
mixins.less and then remove the other imports, but the way I have it
means that each less file is self-contained and this can be really
helpful for tracking down issues or reusing certain bits elsewhere.

Would I be right in thinking that this is a bug rather than
intentional behaviour?

Thanks very much,

John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Hölbling  
View profile  
 More options Feb 9, 5:13 am
From: Daniel Hölbling <tigra...@tigraine.at>
Date: Thu, 9 Feb 2012 11:13:02 +0100
Local: Thurs, Feb 9 2012 5:13 am
Subject: Re: Duplicate definitions

Hi,
It's a lot easier to read if you use a service like Github:Gist to better differentiate between files like this:
https://gist.github.com/1779029

I don't see what the problem is.
You are using .curves() inside .content and inside body.
Therefore it's output twice in your file.

If you wanted .content to also be a mixin you have to use a parameterless mixin:

.content() {
  border: 3px solid red;
  .curves(4px);

}

If you only use the mixin syntax without braces .content dotless can't determine if this is an actual CSS declaration or only a mixin.

greetings Daniel

Am 09.02.2012 um 10:52 schrieb jo...@pdms.com:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John  
View profile  
 More options Feb 9, 5:17 am
From: John <pdmsjo...@gmail.com>
Date: Thu, 9 Feb 2012 02:17:39 -0800 (PST)
Local: Thurs, Feb 9 2012 5:17 am
Subject: Re: Duplicate definitions
Thanks for the quick reply!

The problem is that each selector has the border-radius definition
twice, e.g.

body {
   border: 5px solid #000;
   border-radius: 10px;
   border-radius: 10px;

}

It has "border-radius: 10px" twice, even though I only included the
curves mixin in that selector once.  (And this is also the case for
content which includes border-radius twice).

In my example "curves" is the only mixin - ".content" and "body" are
CSS selectors referring to elements on my page.

John

On Feb 9, 10:13 am, Daniel Hölbling <tigra...@tigraine.at> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Hölbling  
View profile  
 More options Feb 9, 5:31 am
From: Daniel Hölbling <tigra...@tigraine.at>
Date: Thu, 9 Feb 2012 11:31:43 +0100
Local: Thurs, Feb 9 2012 5:31 am
Subject: Re: Duplicate definitions
Oh .. I totally missed that ;)

I guess this is intentional as you could import the same file twice to place some non-mixin declarations.
But: I wonder if it's desireable to have a mixin-function declared twice..

@Luke: You're more familiar with the current codebase.. Any ideas?

greetings Daniel

Am 09.02.2012 um 11:17 schrieb John:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Page  
View profile  
 More options Feb 9, 6:57 am
From: Luke Page <luke.a.p...@gmail.com>
Date: Thu, 9 Feb 2012 11:57:38 +0000
Local: Thurs, Feb 9 2012 6:57 am
Subject: Re: Duplicate definitions
It looks like a bug. it loops round mixin definitions finding one
where the arguments match.. maybe it calls every mixin definition
where the name and arguments match rather than stopping after the
first one..

If so it should be a simple fix I could do soon.

On 9 February 2012 10:31, Daniel Hölbling <tigra...@tigraine.at> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
quark  
View profile  
 More options Feb 9, 8:52 am
From: quark <gothic.qu...@gmail.com>
Date: Thu, 9 Feb 2012 05:52:26 -0800 (PST)
Local: Thurs, Feb 9 2012 8:52 am
Subject: Re: Duplicate definitions
maybe something simple like @include_once will help with this issue?

in less.js:
.m() { color: red; }
.m() { color: black; }
.r { .m; }
returns
.r { color: red; color black; }

which could be expected desired behavior considering property
fallbacks

as example one could make a base.less file with basic css styles for
every browser and then
extend it with fancy.less containing cool fancy new stuff keeping old
css properties as fallback for crappy browsers

On 9 Лют, 13:57, Luke Page <luke.a.p...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Page  
View profile  
 More options Feb 9, 10:05 am
From: Luke Page <luke.a.p...@gmail.com>
Date: Thu, 9 Feb 2012 15:05:12 +0000
Local: Thurs, Feb 9 2012 10:05 am
Subject: Re: Duplicate definitions
Any idea if there is a less.js bug for this? Or do they remove
duplicate rules if the values are the same?

On 9 February 2012 13:52, quark <gothic.qu...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John  
View profile  
 More options Feb 23, 6:22 am
From: John <pdmsjo...@gmail.com>
Date: Thu, 23 Feb 2012 03:22:56 -0800 (PST)
Local: Thurs, Feb 23 2012 6:22 am
Subject: Re: Duplicate definitions
Thanks again for all the replies - sorry for not responding to them
earlier.

I'd not used less.js before, but I managed to get it to compile my
default.less using node.js and it does indeed have the duplicate rules
in there too.

Not sure if this is by-design or a bug ?

On Feb 9, 3:05 pm, Luke Page <luke.a.p...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Transom  
View profile  
 More options Apr 1, 1:12 am
From: Dave Transom <dave.tran...@gmail.com>
Date: Sat, 31 Mar 2012 22:12:58 -0700 (PDT)
Local: Sun, Apr 1 2012 1:12 am
Subject: Re: Duplicate definitions
I also found the same issue (using in the same way as John).

I expected the import to 'overwrite' the previous mixin definition,
but it seems to be appended to the previous mixin definition. I can
understand the mixin behavior - it seems pretty smart/extensible, but
it feels like there needs to be something along the lines of
"@include_once" available - particularly if the same file is imported
_more than once_.

Saying that, I'm not sure a new "@include_once" directive is needed.
Instead, if the compiler/importer tracked the @import files, and then
skipped later imports of the same file - I can't think of a case where
you would want to import the same exact .less file repeatedly.

Has this actually been addressed? I couldn't see evidence in git yet,
but maybe I missed it.

On Feb 23, 11:22 pm, John <pdmsjo...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Page  
View profile  
 More options Apr 1, 4:20 am
From: Luke Page <luke.a.p...@gmail.com>
Date: Sun, 1 Apr 2012 09:20:50 +0100
Local: Sun, Apr 1 2012 4:20 am
Subject: Re: Duplicate definitions

no it hasn't. But less.js has added support for import once and once it is
finalized, it'll be ported.
On Apr 1, 2012 6:12 AM, "Dave Transom" <dave.tran...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »