Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merging duplicate selectors #1101

Closed
euskadi31 opened this issue Jan 5, 2013 · 1 comment
Closed

merging duplicate selectors #1101

euskadi31 opened this issue Jan 5, 2013 · 1 comment

Comments

@euskadi31
Copy link

Hi,

It would be great if LESS output could be configured to more intelligently compress output. Here are some examples:

# Combine multiple declarations
# LESS                             # Preferred Output                 # Current Output
body { border: solid #ccc; }       body{border:3px solid #ccc;}       body{border:solid #ccc;}
body { border-width: 3px; }                                           body{border-width:3px;}

# LESS                             # Preferred Output                 # Current Output
body { color: #ccc; }              body{color:#ccc;cursor:pointer;}   body{color:#ccc;}
body { cursor: pointer; }                                             body{cursor:pointer;}          

# Ignore overridden declarations
# LESS                             # Preferred Output                 # Current Output
body { border: 2px solid #400; }   body{border:3px solid #ccc;}       body{border:2px solid #400;}
body { border: 3px solid #ccc; }                                      body{border:3px solid #ccc;}

Now imagine I have about 50 selectors repeating in each file. The problem is that compiled css is too large and to messy. There are also another use cases. For example, you may use some base stylesheet in many projects.

Example:

base.less

header {
    border: 1px solid #eee;
    .border-radius(5px);
}

style1.less

@import "base.less";

header {
    .border-radius(1px);
}

output

header {
    border: 1px solid #eee;
    -webkit-border-radius: 1px;
       -moz-border-radius: 1px;
            border-radius: 1px;
}

What you think?

@lukeapage
Copy link
Member

duplicate of #930

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants