Less v2 does not compile Twitter's Bootstrap 2.x

前端 未结 5 2113
挽巷
挽巷 2020-12-05 17:30

When compiling Twitter\'s Bootstrap 2.3.2. with Less 2 i found to following error:

NameError: #grid > .core > .span is undefined in /home/bootstrap-2.3         


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 17:56

    The first answer works, though it took me a while to know what to do with it. I haven't done this in like 7 years! So, here is a bit of an explanation of exactly what to do with the code:

    1. Locate the bootstrap.less, and create a new file patch.less in the same directory with the patch code:
    #grid {
        .core  {
            .span(@gridColumns) {
                width: (@gridColumnWidth * @gridColumns) + (@gridGutterWidth * (@gridColumns - 1));
            }
        }
    };
    
    1. Then open the bootstrap.less, it will look something like this:
    /*!
     * Bootstrap v2.3.2
     *
     * Copyright 2012 Twitter, Inc
     * Licensed under the Apache License v2.0
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Designed and built with all the love in the world @twitter by @mdo and @fat.
     */   
            
    
    @import "bootstrap/variables.less"; // Modify this for custom colors, font-sizes, etca
    @import "bootstrap/mixins.less";
    
    // CSS Reset
    @import "bootstrap/reset.less";
    ...
    
    1. After the @import "bootstrap/mixins.less";, you can add the patch.less, so it will look like this:
    
    @import "bootstrap/mixins.less";
    @import "patch.less";
    

提交回复
热议问题