css - yeoman grunt build 不部署组件 css

标签 css ember.js yeoman gruntjs bower

我是 Yeoman 的新手。我用

生成了一个 Ember.js 元素
$ yo ember 

所以我需要安装 Twitter Bootstrap 单独运行

$ bower install bootstrap 

但是正在运行

$ grunt build

不会像将 js 文件部署到 dist/scripts 那样将组件 css 文件部署到 dist/styles 目录

如何在我的元素分发中包含组件 css 文件并在我的 html 中引用它们?

最佳答案

当您将 css 集成到您的 html 文件中时,您通常会这样做(我使用 bootstrap 作为示例):

<link rel="stylesheet" href="bower_components/sass-bootstrap/bootstrap-2.3.2.min.css">

如果您运行 grunt build,这不会部署 css 文件。要将它们部署到您的元素中,请将其包装在 usemin 注释中,就像您处理 javascript 内容一样:

<!-- build:css styles/bootstrap.css -->
<link rel="stylesheet" href="bower_components/sass-bootstrap/bootstrap-2.3.2.min.css">
<!-- endbuild -->

然后这会将此 css 文件作为 styles/bootstrap.css 部署到您的 dist 文件夹中,并更新您的 html 文件中的引用,就像它对 javascript 引用所做的那样.

关于css - yeoman grunt build 不部署组件 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16323963/

相关文章:

javascript - HTML 下拉栏在 Internet Explorer 上不起作用

backbone.js - 客户端应用程序工作流

ember.js - 如何在ember app的 Controller 中获取模板复选框的值

twitter-bootstrap - 在 Ember.JS ember-cli 应用程序中包含 Bootstrap 库的推荐方法

javascript - 恩伯斯 : How to filter by more than one property at once

generator - 找不到 Yeoman 1.0 不是 webapp 生成器?

python - 从 python 调用 yeoman 生成器?

css - 背景大小为 'changing image link/on hover' + 文本定位的问题

jQuery串行滚动: Add class to active item

html - 如何根据单元格内的中间破折号(或其他字符)对齐