gpt4 book ai didi

css - Bootstrap 上的编译器错误更少

转载 作者:行者123 更新时间:2023-11-28 17:43:56 24 4
gpt4 key购买 nike

我正在将一个基于 Node/backbone 的网站移植到 Django 并努力从 less 文件中提取网站 css。

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

我需要将现有的 less 文件编译成 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);

}

}

最佳答案

我在使用 Bootstrap v2.1.1 时遇到了完全相同的问题,我不得不一直恢复到 less v 1.3.x 才能正常工作

关于css - Bootstrap 上的编译器错误更少,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23631806/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com