- 
                Notifications
    
You must be signed in to change notification settings  - Fork 3.4k
 
Change the default behavior of "@import" to only import once. #1010
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
Conversation
      
          
      
      
            ljharb
  
      
      
      commented
        Oct 30, 2012 
      
    
  
- Change the default behavior of "@import" to only import once.
 - Add @import-multiple if for some insane reason you want multiple imports.
 - Continue to support @import-once for backwards compatibility.
 - Fixes Import Each Less File Only Once #212.
 
- Add @import-multiple if for some insane reason you want multiple imports. - Continue to support @import-once for backwards compatibility. - Fixes #212.
        
          
                lib/less/parser.js
              
                Outdated
          
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is a spacing issue here
| 
           just the one minor issue, otherwise its +1 from me. Will pull if no-one else disagrees.  | 
    
| 
           Just thought I'd note here the one insane reason that I can think of for wanting to import the same file more than once (and why I'm glad you're keeping  Quick example: @bar: @foo * 6px;main.less @foo: 2;
@import "dynamic";
.baz {
    width: @foo;      /* 12px */
}
@media only screen and (min-width: 600px) {
    @foo: 5;
    @import "dynamic";
    .baz {
        width: @foo;  /* 30px */
    }
}Also, this is 👍 from me.  | 
    
| 
           @dmcass thanks for the explanation - personally I'd think that's way too much logic in CSS, and I'd rather have dynamic.less have   | 
    
| 
           @ljharb totally agree for the example I gave, but that's much simpler than the actual case where I would use something like that, when multiple variables and mixins change values based on another one with much more complicated math.  | 
    
| 
           I see the theoretical case here, but to me, the complexity it adds just lends more weight to importing once, so that no one ever ever does this. ;-)  | 
    
| 
           I'd have to agree. Especially if an   | 
    
| 
           pushed to 1.4.0  |