Configuring Google Fonts can be quite an annoying process to setup. Using Font Magician with PostCSS allows you simply generate proper @font-face declarations simply by writing the Google Font that you're expecting. Want Merriweather? Simply type font-family: "Merriweather" and Font Magician will generate everything you need.

Install:

npm i poi postcss postcss-font-magician -D

Config:

const magician = require('postcss-font-magician');

module.exports = {
plugins: [
magician({
variants: {
'Merriweather': {
'300': [],
'400': []
},
'Nunito': {
'300': [],
'400': []
}
}
})
]
};

Doc

Use:

* {
font-family: "Merriweather";
}
h1 {
font-family: 'Nunito';
}

Build:

poi build

After build, we will get css file, which can be used in your project

[PostCss] Easily Load Google Fonts with PostCSS Font Magician的更多相关文章

  1. Get Started with the Google Fonts API

    Get Started with the Google Fonts API This guide explains how to use the Google Fonts API to add fon ...

  2. Google css & Google fonts

    最近用某开源模板做提案的时候, 抓包工具老是有外部Request. 问题出在某css中有这么一句: @import url(https://fonts.googleapis.com/css?famil ...

  3. 使用 Google Fonts 为网页添加美观字体

    前言 文字是网页中很重要的组成部分.为文字选择一个合适的字体,能够更好的展现一个网站的个性,表达所要传递的信息,同时吸引用户来产生兴趣. 说到字体,我们首先会想到 CSS 里面的 font,例如: & ...

  4. 使用Google Fonts注意事项

    Google Fonts是一个字体嵌入服务库. 这包括免费和开源字体系列.用于浏览库的交互式 Web 目录以及用于通过 CSS 和 Android 使用字体的 API. Google 字体库中的流行字 ...

  5. google fonts 国内使用解决方案

    由于众所周知的原因,国内使用google font库有很大的问题. 解决方案1:使用国内镜像如360网站卫士常用前端公共库CDN服务 优点:使用方便 缺点:目标用户包含国外的开发者,不清楚国外用户的加 ...

  6. bootstrap之google fonts

    bootstrap之google fonts 在学习一个bootstrap时,看到了一行引用代码:@import url(http://fonts.googleapis.com/css?family= ...

  7. (转)Google Fonts 的介绍与使用

    转载自“前端笔记”  http://www.cnblogs.com/milly/archive/2013/05/10/google-fonts.html Google Fonts 是什么?(以下翻译为 ...

  8. 前端 CDNJS 库及 Google Fonts、Ajax 和 Gravatar 国内加速服务

    由于某些众所周知的原因,好多开源的 JS 库采用的国外 CDN 托管方式在国内访问速度不如人意.所以我们特意制作了这个公益项目,托管了 CDNJS 的所有开源 JS 库以及反代了 Google Fon ...

  9. webpack 解决 semantic ui 中 google fonts 引用的问题

    semantic ui css 的第一行引用了 google web font api,由于不可告人而又众所周知的原因,这条链接在国内无法访问: @import url('https://fonts. ...

随机推荐

  1. DELL inspiron 14-7467 进入安全模式方法

    您按住shift键不要松开,然后重启电脑,选择疑难解答-高级选项-启动设置-数字四 安全模式启动

  2. WebSocket 前端封装

    $.extend({ socketWeb:function (opt) { if("WebSocket" in window){ var setting=$.extend({ ur ...

  3. 在学校机房联想硬盘保护下安装Linux,并配置锐捷客户端

    最近几天一直在机房里刷题,空调开着非常舒服.但是机房电脑里全是windows系统,不太好用,挺膈应人的. 一直打算换个系统,刚才终于搞定网络问题了,以后用电脑就可以爽到了. 联想硬盘保护系统下u盘安装 ...

  4. Nginx 安装 自用

    hostnamectl set-hostname nginx systemctl stop firewalld.service systemctl disable firewalld.service ...

  5. Zookeeper入门-Linux环境下异常ConnectionLossException解决

    实际项目开发中,用的是Linux环境.  中午突然断电,死活连不上Zookeeper,最终发现是需要关闭防火墙.    看日志,报错如下:  Exception in thread "mai ...

  6. "pom.xml" could not be activated because it does not exist.

    "pom.xml" could not be activated because it does not exist. 在sts中使用maven build,输入package然后 ...

  7. [MST] Describe Your Application Domain Using mobx-state-tree(MST) Models

    In this lesson, we introduce the running example of this course, a wishlist app. We will take a look ...

  8. 关于Android制作.9.png图片

    第一个问题,.9格式的图片与我们之前的一般图片有什么问题呢? 这是安卓开发里面的一种特殊的图片. 这样的格式的图片在android 环境下具有自适应调节大小的能力. (1)同意开发者定义可扩展区域,当 ...

  9. 物理读之LRU(近期最少被使用)的深入解析

    转载请注明出处: http://blog.csdn.net/guoyjoe/article/details/38264883 一组LRU链表包含LRU主链.LRU辅助链.LRUW主链,LRUW辅助链, ...

  10. cocos2dx 几个精灵依照顺序播放动画解决方法

    我先描写叙述一下这个问题: 拿之前做的卡牌游戏来说.假设一方场上有3张牌,那么肯定要以一种顺序来播放攻击动画.我是以从左到右的方式. 我的解决方案是向每张牌都传递一个延时參数,然后在runAction ...