你在选择Bootstrap选项时是否使用了Sass版本的Bootstrap?我刚刚使用以下选项进行了设置。
? Would you like to use Sass (with Compass)? Yes
? Would you like to include Bootstrap? Yes
? Would you like to use the Sass version of Bootstrap? Yes
这对我来说很好。
当您使用此流程时,请在您的main.scss文件中包含以下行。
// bower:scss
@import "bootstrap-sass-official/assets/stylesheets/_bootstrap.scss";
// endbower
如果有必要,一定要应用Bootstrap样式。
如果您选择不使用Bootstrap选项,则需要在命令行中使用以下命令安装Bootstrap。
bower install bootstrap -S
'-S'是必需的。之后,如果没有将bootstrap.css文件注入index.html,则需要在安装Bootstrap文件夹中的bower.json文件中进行小修改。请浏览以下位置以查找bower.json。
/bower_components/bootstrap/
打开 bower.js 文件,查找以下代码片段:
"main": [
"less/bootstrap.less",
"dist/js/bootstrap.js"
],
and change as follow,
"main": [
"less/bootstrap.less",
"dist/js/bootstrap.js",
"dist/js/bootstrap.css",
"dist/js/bootstrap-theme.css"
],
保存文件并再次运行grunt serve命令。
src: ["<%= yeoman.app %>/index.html"], ignorePath:/\.\.\//
。 - rodp82