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. UVa 10943 How do you add?【递推】

    题意:给出n,k,问恰好有k个不超过n的数的和为n的方案数有多少 可以隔板法来做 现在有n个小球放到k个盒子里面,盒子可以为空 那么就是n-k+1个缝隙,放上k-1个隔板(k-1个隔板就分成了k份) ...

  2. oracle11g文件系统库迁移到ASM库上面

    最近把oracle11g的文件系统库迁移到了asm库上面. 迁移过程大致如下: 最少停机方案: 实例joinpay02 | |数据库joinpay02 需要改动的文件: 数据文件 控制文件 redo文 ...

  3. WebSocket 前端封装

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

  4. Mean, Median, Mode, Range, and Standard Deviation

    Descriptive statistics tell you about the distribution of data points in data set. The most common m ...

  5. 四则运算1 java+jsp+SQLServer

    1,设计思想(1)在java resourse里定义包和类 (2)在类里定义生成算式,并将算式保存在数据库中的方法 (3)在jsp文件中调用java方法 2,源程序代码 生成算式的方法 public ...

  6. mac pro配置php开发环境

    mac pro自带php和apache,所以我们只要配置下就好了 // 启动Apache服务 sudo apachectl start // 重启Apache服务 sudo apachectl res ...

  7. C++容器(三):pair类型

    pair类型 在开始介绍关联容器之前,我们有必要了解一种与之相关的标准库类型–pair类型. 操作 含义 pair<T1, T2> p1 创建一个空的pair对象,它的两个元素分别为T1和 ...

  8. [android] 百度地图开发 (一).申请AK显示地图及解决显示空白网格问题

        近期做android百度地图,可是使用baidumapapi_v2_3_1.jar和libBaiduMapSDK_v2_3_1.so显示百度地图时总是遇到问题--仅仅显示网格而没有显示地图,网 ...

  9. 【C语言】递归函数DigitSum(n)

    //写一个递归函数DigitSum(n),输入一个非负整数,返回组成它的数字之和, //比如,调用DigitSum(1729),则应该返回1+7+2+9,它的和是19 #include <std ...

  10. ubuntu 14.04 桌面版关闭图形界面

    ubuntu 14.04 桌面版关闭图形界面 问题: 怎样将ubuntu14.04设置为文本模式启动? 解决方式: 改动改GRUB 的配置文件(不建议直接改 grub.conf) $sudo vim ...