Skip to content

Instantly share code, notes, and snippets.

@mpalpha
Created July 13, 2021 15:40
Show Gist options
  • Save mpalpha/e42cb9825009d1b6b6360c806347f5a6 to your computer and use it in GitHub Desktop.
Save mpalpha/e42cb9825009d1b6b6360c806347f5a6 to your computer and use it in GitHub Desktop.
tailwindcss: include google font family plugin
// tailwind.config.js
const plugin = require('tailwindcss/plugin');
module.exports = {
theme: {
fontFamily: {
sans: ['Roboto Condensed'],
},
},
plugins: [
plugin(({ addBase }) => {
const customFonts = [
{
'@font-face': {
fontFamily: 'Roboto Condensed',
fontWeight: '300',
fontStyle: 'italic',
fontDisplay: 'swap',
src: 'url(https://fonts.gstatic.com/s/robotocondensed/v19/ieVg2ZhZI2eCN5jzbjEETS9weq8-19eDpCEobdNZUSdy4Q.woff2) format(\'woff\')',
unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',
},
},
{
'@font-face': {
fontFamily: 'Roboto Condensed',
fontWeight: '300',
fontStyle: 'normal',
fontDisplay: 'swap',
src: 'url(https://fonts.gstatic.com/s/robotocondensed/v19/ieVi2ZhZI2eCN5jzbjEETS9weq8-33mZGCQYb9lecyU.woff2) format(\'woff\')',
unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',
},
},
];
return addBase(customFonts);
}),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment