我刚下载了一个intializr生成的Bootstrap版本。我还安装了SimpLESS,以避免不得不手动重新编译我的LESS文件并避免使用浏览器内编译器。但是,SimpLESS拒绝在我的目录中编译非常基本的style.css文件。它吐了出来:
Result of expresiin style.less on 'e.message' [undefined] is not an object.
注意:"表达"确实是按照它出现的方式拼写的。
我的style.less文件目前看起来像这样:
@import "bootstrap/bootstrap.less";
body {
padding-top: 60px;
padding-bottom: 40px;
}
@import "bootstrap/responsive.less";
答案 0 :(得分:6)
我遇到了同样的问题,而我的解决方法是没有嵌套的@imports。我在Win7上使用SimpLESS 1.4和Bootstrap 2.1.0,如果你的style.less文件看起来像这样,它就可以了:
// CSS Reset
@import "reset.less";
// Core variables and mixins
@import "variables.less"; // Modify this for custom colors, font-sizes, etc
@import "mixins.less";
// Grid system and page structure
@import "scaffolding.less";
@import "grid.less";
@import "layouts.less";
// Base CSS
@import "type.less";
@import "code.less";
@import "forms.less";
@import "tables.less";
// Components: common
@import "sprites.less";
@import "dropdowns.less";
@import "wells.less";
@import "component-animations.less";
@import "close.less";
// Components: Buttons & Alerts
@import "buttons.less";
@import "button-groups.less";
@import "alerts.less"; // Note: alerts share common CSS with buttons and thus have styles in buttons.less
// Components: Nav
@import "navs.less";
@import "navbar.less";
@import "breadcrumbs.less";
@import "pagination.less";
@import "pager.less";
// Components: Popovers
@import "modals.less";
@import "tooltip.less";
@import "popovers.less";
// Components: Misc
@import "thumbnails.less";
@import "labels-badges.less";
@import "progress-bars.less";
@import "accordion.less";
@import "bootstrap/carousel.less";
@import "bootstrap/hero-unit.less";
// Utility classes
@import "utilities.less"; // Has to be last to override when necessary
//Needed if using fixed navbar
body {
padding-top: 60px;
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px 0;
}
// RESPONSIVE CLASSES
// ------------------
@import "responsive-utilities.less";
// MEDIA QUERIES
// ------------------
// Large desktops
@import "responsive-1200px-min.less";
// Tablets to regular desktops
@import "responsive-768px-979px.less";
// Phones to portrait tablets and narrow desktops
@import "responsive-767px-max.less";
// RESPONSIVE NAVBAR
// ------------------
// From 979px and below, show a button to toggle navbar contents
@import "responsive-navbar.less";
答案 1 :(得分:1)
我没有尝试使用SimpleLESS很长时间,似乎根本没有编译bootstrap。
您可以尝试使用lesscss.org提供的JavaScript,也可以尝试php less compiler(我还没有尝试过这个)。
如果您只想不时编译,这是一个非常基本的编译器示例。 http://pastebin.com/vXXFdvnk
否则请检查lesscss.org propositions。