css - Ionic2 $font-family-base 不工作

标签 css ionic-framework sass ionic2 ionic3

Ionic2 中的变量 $font-family-base 不起作用。

app.variable.scss 文件中我添加了一个新值,但旧值仍然存在。

$font-size-base 等其他变量工作正常

这些是我构建 www 的 gulp 任务:

gulp.task("fonts", function () {
    return copyFonts({
        src: [
          "app/fonts/**/*.+(eot|ttf|woff|woff2|svg)"
        ]
    });
});

gulp.task("sass", function () {
    return buildSass({
        sassOptions: {
            includePaths: [
              "node_modules/ionic-angular",
              "node_modules/ionicons/dist/scss"
            ]
        }
    });
});

我错过了什么?

那是我的字体

@font-face {
  font-family: "Maven Pro";
  font-style: normal;
  font-weight: 400;
  src: local("Maven Pro"), local("Maven-Pro-Regular"), url("#{$font-path}/MavenPro-Regular.ttf") format("truetype");
}

@font-face {
  font-family: "Maven Pro";
  font-style: normal;
  font-weight: 500;
  src: local("Maven Pro Medium"), local("Maven-Pro-Medium"), url("#{$font-path}/MavenPro-Medium.ttf") format("truetype");
}

@font-face {
  font-family: "Maven Pro";
  font-style: normal;
  font-weight: 700;
  src: local("Maven Pro Bold"), local("Maven-Pro-Bold"), url("#{$font-path}/MavenPro-Bold.ttf") format("truetype");
}

@font-face {
  font-family: "Maven Pro";
  font-style: normal;
  font-weight: 900;
  src: local("Maven Pro Ultra Bold"), local("Maven-Pro-Regular-Ultra-Bold"), url("#{$font-path}/MavenPro-Black.ttf") format("truetype");
}

这个font-faces 在我的app.scss 文件中,它在我的app.core.scss

中被引用

app.core.scss:

// http://ionicframework.com/docs/v2/theming/

// App Shared Imports
// --------------------------------------------------
// These are the imports which make up the design of this app.
// By default each design mode includes these shared imports.
// App Shared Sass variables belong in app.variables.scss.
@import "../app";

@import "../users/sus/sus";
@import "../users/sus/home/home";
@import "../users/sus/subjects/german/german";
@import "../users/sus/subjects/math/math";

更新:

如果我使用特定的设备 sass 变量来做到这一点,即:

  • $font-family-md-base
  • $font-family-ios-base
  • $font-family-wp-base

这是一个奇怪的行为,但我想 $font-family-base 必须设置在特定的顺序或文件中,我仍然没有弄明白。

最佳答案

我刚问过Mike (来自 Ionic Team)他告诉我:

$font-family-ios-base is for when it is on an ios device

同样适用于

$font-family-md-base

$font-family-wp-base

但我认为关键在于:

$font-family-base is when it's neither ios or md

我认为这可以解释您所说的行为。因此,在您的情况下,您需要更改该字体的值

$font-family-md-base
$font-family-ios-base
$font-family-wp-base

或它们中的任何一个以使其工作。

关于css - Ionic2 $font-family-base 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37944757/

相关文章:

ruby-on-rails - Rails 4 Heroku 部署错误 : Precompiling assets failed - cannot import/find boostrap file

jquery - 当设备方向改变时重置 jquery max-height

html - 用CSS模拟COLSPAN不结束之前的TR

android - 为什么任务包装函数不起作用

html - 添加图标以在链接中显示多种文件类型

css - SASS 和 Bootstrap - mixins 与 @extend

javascript - 用 jQuery 删除的 Div 仍然存在吗?

css - fullPage.js 菜单消失

ios - 在 Ionic Cordova 应用程序中,iframe 中的跨源内容中的外部超链接可在 Android 上运行,但在 iOS 上不起作用

javascript - ionic angular 对于 ng-bind 和 {{}} 的工作方式不同不知道为什么?