我是 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/