首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用sass的Unboud变量

使用sass的Unboud变量
EN

Stack Overflow用户
提问于 2015-02-24 20:41:58
回答 2查看 1.6K关注 0票数 1

我使用https://github.com/Swiip/generator-gulp-angular来规范我的angularjs应用程序。

我平实地发现了引导主题,并希望使用它,并从[http://bootswatch.com/flatly/][2]下载两个文件,_variables.scss和_bootswatch.scss。

我将这两个文件添加到我的vendor.scss中

代码语言:javascript
复制
$icon-font-path: "../../bower_components/bootstrap-sass-official/assets/fonts/bootstrap/";

@import '../../bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap';

@import "flatly/variables";
@import "flatly/bootswatch";

使用gulp serve,我构建了我的应用程序,并在控制台上展示了它。

代码语言:javascript
复制
project developer$ gulp serve
[21:28:41] Using gulpfile /Volumes/Developer/angularjs/project/gulpfile.js
[21:28:41] Starting 'styles'...
[21:28:42] gulp-inject 2 files into index.scss.

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: /Volumes/Developer/angularjs/project/src/app/flatly/_bootswatch.scss:16: error: unbound variable $navbar-default-bg 

  [1]: https://github.com/Swiip/generator-gulp-angular
  [2]: http://bootswatch.com/flatly/

为什么unbound variable $navbar-default-bg但是$navbar-default-bg存在于_variables.scss文件中。

$navbar-默认-bg:$品牌-主要;

我的项目结构:

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-03-18 10:25:50

在自定义_variables.scss的开头导入index.scss文件:

代码语言:javascript
复制
@import '../../../bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap/variables';

另一种方法可能是遵循这些指令-- >> https://github.com/Swiip/generator-gulp-angular/issues/379。不过我还没试过呢。

票数 2
EN

Stack Overflow用户

发布于 2015-02-25 10:55:14

尝试按以下顺序导入变量、引导程序、引导程序( https://github.com/thomaspark/bootswatch/blob/gh-pages/global/build.scss )

代码语言:javascript
复制
@import "flatly/variables";
@import '../../bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap';
@import "flatly/bootswatch";

样板试图编译src文件夹中的所有.scss文件(当它应该忽略从_开始的scss文件时)。

在/src的外面移动平缓使它表现为

代码语言:javascript
复制
@import "../../flatly/variables";
@import '../../bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap';
@import "../../flatly/bootswatch";
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28705826

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档