引导程序上的编译器错误较少

时间:2014-05-13 12:50:34

标签: css node.js twitter-bootstrap less

我正在将一个基于节点/骨干网站移植到django并努力从较少的文件中提取网站css。

我最初尝试从浏览器中提取CSS,但在渲染过程中会出现问题,如果我使用它,一切都会关闭。

我需要将现有的较少文件编译成css,而我正在尝试使用lessc

以下是我得到的错误:

[rep@localhost style]$ node --version
v0.10.26

[rep@localhost style]$ lessc --version
lessc 1.7.0 (LESS Compiler) [JavaScript]

[rep@localhost style]$ lessc base.less
ParseError: Unrecognised input in /home/rep/style/bootstrap/mixins.less on line 549, column 3:
548 
549   .core (@gridColumnWidth, @gridGutterWidth) {
550 

违规代码是:

// The Grid
#grid {
.core (@gridColumnWidth, @gridGutterWidth) 
{

  .spanX (@index) when (@index > 0) 
  {
    (~".span@{index}") { .span(@index); }
    .spanX(@index - 1);
  }

  .spanX (0) {}

  .offsetX (@index) when (@index > 0) 
  {
    (~".offset@{index}") { .offset(@index); }
    .offsetX(@index - 1);
  }
  .offsetX (0) {}

  .offset (@columns) 
  {
    margin-left: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns + 1));
  }

  .span (@columns) 
  {
    width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
  }

  .row 
  {
    margin-left: @gridGutterWidth * -1;
    .clearfix();
  }

  [class*="span"] 
  {
    float: left;
    margin-left: @gridGutterWidth;
  }

  // Set the container width, and override it for fixed navbars in media queries
  .container,
  .navbar-static-top .container,
  .navbar-fixed-top .container,
  .navbar-fixed-bottom .container { .span(@gridColumns); }

  // generate .spanX and .offsetX
  .spanX (@gridColumns);
  .offsetX (@gridColumns);

}

.fluid (@fluidGridColumnWidth, @fluidGridGutterWidth) {

.spanX (@index) when (@index > 0) {
  (~".span@{index}") { .span(@index); }
  .spanX(@index - 1);
}
.spanX (0) {}

.offsetX (@index) when (@index > 0) {
  (~'.offset@{index}') { .offset(@index); }
  (~'.offset@{index}:first-child') { .offsetFirstChild(@index); }
  .offsetX(@index - 1);
}
.offsetX (0) {}

.offset (@columns) {
  margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) + (@fluidGridGutterWidth*2);
  *margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%) + (@fluidGridGutterWidth*2) - (.5 / @gridRowWidth * 100 * 1%);
}

.offsetFirstChild (@columns) {
  margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) + (@fluidGridGutterWidth);
  *margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%) + @fluidGridGutterWidth - (.5 / @gridRowWidth * 100 * 1%);
}

    .span (@columns) {
      width: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1));
      *width: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%);
    }

    .row-fluid {
      width: 100%;
      .clearfix();
      [class*="span"] {
        .input-block-level();
        float: left;
        margin-left: @fluidGridGutterWidth;
        *margin-left: @fluidGridGutterWidth - (.5 / @gridRowWidth * 100 * 1%);
      }
      [class*="span"]:first-child {
        margin-left: 0;
      }

      // generate .spanX and .offsetX
      .spanX (@gridColumns);
      .offsetX (@gridColumns);
    }

      }



 .input(@gridColumnWidth, @gridGutterWidth) {
    .spanX (@index) when (@index > 0) {
      (~"input.span@{index}, textarea.span@{index}, .uneditable-input.span@{index}") { .span(@index); }
      .spanX(@index - 1);
    }
    .spanX (0) {}

    .span(@columns) {
      width: ((@gridColumnWidth) * @columns) + (@gridGutterWidth * (@columns - 1)) - 14;
    }

    input,
    textarea,
    .uneditable-input {
      margin-left: 0; // override margin-left from core grid system
    }

    // Space grid-sized controls properly if multiple per line
    .controls-row [class*="span"] + [class*="span"] {
      margin-left: @gridGutterWidth;
    }

    // generate .spanX
    .spanX (@gridColumns);

  }

}

1 个答案:

答案 0 :(得分:1)

我使用Bootstrap v2.1.1时遇到了完全相同的问题我不得不一直恢复到较少的v 1.3.x以使其正常工作