编译和使用Bootstrap LESS文件

时间:2015-10-28 16:16:52

标签: twitter-bootstrap less

我想在我的Django / Dojo项目中使用Bootstrap CSS。我已经下载了包含文件的存档,并将所有LESS提取到单独的文件夹中。

问题是在LESS编译期间我遇到了错误 - 大多数bootstrap LESS文件都使用variables.less中的变量,但是没有指定import语句。

有没有办法解决这个问题,或者是否必须手动添加`import“variables.less”;'每个文件?

1 个答案:

答案 0 :(得分:2)

Bootstrap使用bootstrap.less文件导入其他*.less Bootstrap文件。您必须编译bootstrap.less,当您看到错误时,您可能正在尝试编译其他.less文件,而这些文件根本没有@import规则。

bootstrap.less:

/*!
 * Bootstrap v3.3.5 (http://getbootstrap.com)
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 */

// Core variables and mixins
@import "variables.less";
@import "mixins.less";

// Reset and dependencies
@import "normalize.less";
@import "print.less";
@import "glyphicons.less";

// Core CSS
@import "scaffolding.less";
@import "type.less";
@import "code.less";
@import "grid.less";
@import "tables.less";
@import "forms.less";
@import "buttons.less";

// Components
@import "component-animations.less";
@import "dropdowns.less";
@import "button-groups.less";
@import "input-groups.less";
@import "navs.less";
@import "navbar.less";
@import "breadcrumbs.less";
@import "pagination.less";
@import "pager.less";
@import "labels.less";
@import "badges.less";
@import "jumbotron.less";
@import "thumbnails.less";
@import "alerts.less";
@import "progress-bars.less";
@import "media.less";
@import "list-group.less";
@import "panels.less";
@import "responsive-embed.less";
@import "wells.less";
@import "close.less";

// Components w/ JavaScript
@import "modals.less";
@import "tooltip.less";
@import "popovers.less";
@import "carousel.less";

// Utility classes
@import "utilities.less";
@import "responsive-utilities.less";