- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
因此,我正在尝试编写一个小型 Meteor 包,其中包含 LESS 版本的 Bootstrap 以及我最喜欢的 Bootswatch 主题。我显然做错了什么,因为当我尝试使用普通的 Bootstrap 网格系统时,什么也没有发生。
package.js
Package.describe({
summary: "Bootstrap 3, using Sandstone Bootswatch. (LESS version)",
version: "3.2.0",
git: "https://github.com/czbaker/meteor-bootstrap-3-sandstone"
});
Package.onUse(function(api) {
// For Meteor 0.9.1.1
api.versionsFrom('METEOR@0.9.1.1');
// Dependencies
api.use('less', 'client');
api.use('jquery', 'client');
// Bootstrap's Javascript Stuff
api.add_files('lib/js/transition.js', 'client');
api.add_files('lib/js/alert.js', 'client');
api.add_files('lib/js/button.js', 'client');
api.add_files('lib/js/carousel.js', 'client');
api.add_files('lib/js/collapse.js', 'client');
api.add_files('lib/js/dropdown.js', 'client');
api.add_files('lib/js/modal.js', 'client');
api.add_files('lib/js/tooltip.js', 'client');
api.add_files('lib/js/popover.js', 'client');
api.add_files('lib/js/scrollspy.js', 'client');
api.add_files('lib/js/tab.js', 'client');
api.add_files('lib/js/affix.js', 'client');
// Fonts
api.add_files('lib/fonts/glyphicons-halflings-regular.eot', 'client');
api.add_files('lib/fonts/glyphicons-halflings-regular.svg', 'client');
api.add_files('lib/fonts/glyphicons-halflings-regular.ttf', 'client');
api.add_files('lib/fonts/glyphicons-halflings-regular.woff', 'client');
});
这是松散地基于 0.9 之前的包,并且将处理(希望)在 Bootstrap 中提供 JavaScript 的东西。我的问题目前是 LESS 文件。这是我的包的树:
misutowolf@jakiro ~/projects/bootstrap-3-sandstone-less $ tree
.
├── lib
│ ├── fonts
│ │ ├── glyphicons-halflings-regular.eot
│ │ ├── glyphicons-halflings-regular.svg
│ │ ├── glyphicons-halflings-regular.ttf
│ │ └── glyphicons-halflings-regular.woff
│ ├── js
│ │ ├── affix.js
│ │ ├── alert.js
│ │ ├── button.js
│ │ ├── carousel.js
│ │ ├── collapse.js
│ │ ├── dropdown.js
│ │ ├── modal.js
│ │ ├── popover.js
│ │ ├── scrollspy.js
│ │ ├── tab.js
│ │ ├── tooltip.js
│ │ └── transition.js
│ └── less
│ ├── alerts.import.less
│ ├── badges.import.less
│ ├── bootstrap.import.less
│ ├── bootswatch.import.less
│ ├── breadcrumbs.import.less
│ ├── button-groups.import.less
│ ├── buttons.import.less
│ ├── carousel.import.less
│ ├── close.import.less
│ ├── code.import.less
│ ├── component-animations.import.less
│ ├── dropdowns.import.less
│ ├── forms.import.less
│ ├── glyphicons.import.less
│ ├── grid.import.less
│ ├── input-groups.import.less
│ ├── jumbotron.import.less
│ ├── labels.import.less
│ ├── list-group.import.less
│ ├── media.import.less
│ ├── mixins
│ │ ├── alerts.import.less
│ │ ├── background-variant.import.less
│ │ ├── border-radius.import.less
│ │ ├── buttons.import.less
│ │ ├── center-block.import.less
│ │ ├── clearfix.import.less
│ │ ├── forms.import.less
│ │ ├── gradients.import.less
│ │ ├── grid-framework.import.less
│ │ ├── grid.import.less
│ │ ├── hide-text.import.less
│ │ ├── image.import.less
│ │ ├── labels.import.less
│ │ ├── list-group.import.less
│ │ ├── nav-divider.import.less
│ │ ├── nav-vertical-align.import.less
│ │ ├── opacity.import.less
│ │ ├── pagination.import.less
│ │ ├── panels.import.less
│ │ ├── progress-bar.import.less
│ │ ├── reset-filter.import.less
│ │ ├── resize.import.less
│ │ ├── responsive-visibility.import.less
│ │ ├── size.import.less
│ │ ├── tab-focus.import.less
│ │ ├── table-row.import.less
│ │ ├── text-emphasis.import.less
│ │ ├── text-overflow.import.less
│ │ └── vendor-prefixes.import.less
│ ├── mixins.import.less
│ ├── modals.import.less
│ ├── navbar.import.less
│ ├── navs.import.less
│ ├── normalize.import.less
│ ├── pager.import.less
│ ├── pagination.import.less
│ ├── panels.import.less
│ ├── popovers.import.less
│ ├── print.import.less
│ ├── progress-bars.import.less
│ ├── responsive-embed.import.less
│ ├── responsive-utilities.import.less
│ ├── scaffolding.import.less
│ ├── tables.import.less
│ ├── theme.import.less
│ ├── thumbnails.import.less
│ ├── tooltip.import.less
│ ├── type.import.less
│ ├── utilities.import.less
│ ├── variables.import.less
│ └── wells.import.less
├── package.js
└── versions.json
所以,我知道为了让 Meteor 不处理 LESS 文件,它们必须命名为 <file>.import.less
,这很好。我不明白的是从这里去哪里。
在我的元素(测试)中,我假设我需要编写一个主要的 .less
文件,这将导入主要的 bootstrap.import.less
从我的包裹里,但我不知道它在哪里,可以这么说。在 0.9 之前,这应该在 /packages/<package>/lib/less/bootstrap.import.less
中,或类似的东西。
我在这里错过了什么?我还想如果我只是放弃 .import
从主 Bootstrap “容器”中,它只会作为包的一部分包含在内,并将其提供给我的应用程序,但事实也并非如此。如果是这样,我会这样做,然后使用 api.add_files('lib/less/bootstrap.less');
提供给客户?
最佳答案
当使用 api.add_files
在包中添加一个 .less
文件时,当包被绑定(bind)时实际发生的是,它被转换为一个 。 less.css
文件。所以没有可供您使用的mixin。此外,如果要使用真正的 .less
文件,您需要在要使用混入/变量的文件中@import
它。
有一个黑客。您可以将文件作为 Assets 添加到服务器。
api.add_files([
"lib/less/variables.less",
"lib/less/mixins.less"
... add all the mixins .less files here too...
], "server", {
isAsset: true
})
您还需要在/mixins 文件夹中添加所有 less 文件,因为这些文件是使用 mixins.less
中的相对路径导入的。
您可以@import
变量/mixins 然后在您自己的.less
文件中,使用这个古怪的路径:
@bootstrap-path: ".meteor/local/build/programs/server/assets/packages/{your_user_name}_{your_package_name}/lib/less";
@import "@{bootstrap-path}/mixins.less";
将 {your_user_name}_{your_package_name}
替换为您发布包时使用的名称。 user:package
将得到 user_package
。
但请记住,发送到客户端的 Bootstrap less 代码已经转换为 css,因此无法更改变量或 mixins 来调整 Bootstrap 设置。
关于javascript - Meteor、LESS 和 Bootstrap (Bootswatch),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25712430/
我在尝试使用 WebStorm LESS File Watcher 时遇到此错误 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/
我有一个带有以下结构的 .less 样式表: @width:600; .some-style { width:@{width}px; } 这给出了以下错误: Expected '}' on l
说我有以下结构 /node_modules /src /components /component1 /style /style.less
我想使用灰度函数,但 LESS 一直抛出此错误,我没有看到灰度的 mixin 或如何使用它。有什么帮助吗? Error 148 Expected color in function 'graysc
我的文件较少,如下面的目录结构 vendor/includes/file1.less vendor/includes/file1.less vendor/includes/file1
如果我在 LESS 中定义以下嵌套样式: .nav-bar { .navbar-brand { background: #000; } } .nav-bar {
我正在尝试设置一个使用 lein-less 插件编译 .less 文件的 clojurescript 项目。我应该说我是 clojurescript 的新手。问题是它似乎没有运行。它在我运行“lein
有人会这样使用“less”: var less = require('less'); less.render('.class { width: (1 + 1) }', function (e, css
我正在尝试在一个新元素中测试 less.js。我 100% 确定 javascript 文件加载正常,但我的 css 文件夹中的 less 文件一直出现此错误。我打算在启动之前使用 less.app
我有以下更少: .container { .column, .columns { .one& { width: 40px; }
这是一个代码(test.less): body { padding: 50px; } body { padding: 20px; } 为什么在编译成 CSS 后我有这个: body {
我有一个变量 @index我想输出一个选择器,以便当 @index是 3 , 选择器是 [data-sth="3"] . 更长的例子: @index: 3; /* selector here */ {
假设我有一个使用 Less 定义的样式: ul.unstyled, ol.unstyled { margin-left: 0; list-style: none; } 稍后,我想重新使用 un
假设我有以下 Less 设置: .box { border: 1px solid #333; &.error { background-color: Red; } } 如果我想
我有一个 common.less文件,它为不同的皮肤实现了基本的 CSS: @textColor: black; @iconSize: 16px; .container: { color: @
我创建了使用 LESS 功能切换主题的代码。不幸的是,LESS 文件不会在浏览器中编译。如何在浏览器中编译 LESS 文件? 最佳答案 这是一张documentation : Client-side
我想使用 less 来定位类中的特定元素。 在这种情况下,我想定位类 button 的元素,但在此范围内我想定位一个 anchor 标签 a . 目前我有: .button { /* lots
我正在努力做某事。我的项目是这样的: /app /assets /components /stylesheets /less
我目前正在一个项目中使用 Twitter Bootstrap,包括 LESS 文件并使用我们编写的一些附加 LESS 代码进行编译。 最新版本意味着我们需要覆盖一些 Bootstrap LESS 变量
我有这个更少的代码,这工作得很好。我只是想在 less cli 编译它时节省一些空间。 .secondary-content { background: #ffcc80; color:
我是一名优秀的程序员,十分优秀!