Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

fontsource-source-sans-pro

fontsource644MITdeprecated4.0.0

Package relocated. Please install and migrate to @fontsource/source-sans-pro.

Source Sans Pro font in NPM glory.

fontsource, font, font family, google fonts, Source Sans Pro, source-sans-pro

readme

Fontsource Source Sans Pro

npm (scoped) Generic badge Monthly downloads Total downloads GitHub stars

The CSS and web font files to easily self-host the “Source Sans Pro” font. Please visit the main Fontsource monorepo to view more details on this package.

Installation

Fontsource assumes you are using a bundler, such as Webpack, to load in CSS. Solutions like CRA, Gatsby and Next.js are prebuilt examples that are compatible.

yarn add @fontsource/source-sans-pro // npm install @fontsource/source-sans-pro

Then within your app entry file or site component, import it in. For example in Gatsby, you could choose to import it into a layout template (layout.js), page component (index.js), or gatsby-browser.js.

import "@fontsource/source-sans-pro" // Defaults to weight 400.

Fontsource allows you to select weights and even individual styles, allowing you to cut down on payload sizes to the last byte! Utilizing the CSS unicode-range selector, all language subsets are accounted for.

import "@fontsource/source-sans-pro/500.css" // Weight 500.
import "@fontsource/source-sans-pro/900-italic.css" // Italic variant.

Alternatively, the same solutions could be imported via SCSS!

@import "~@fontsource/source-sans-pro/index.css"; // Weight 400.
@import "~@fontsource/source-sans-pro/300-italic.css";

These examples may not reflect actual compatibility. Please refer below.

Supported variables:

  • Weights: [200,300,400,600,700,900]
  • Styles: [italic,normal]

Finally, you can reference the font name in a CSS stylesheet, CSS Module, or CSS-in-JS.

body {
  font-family: "Source Sans Pro";
}

Additional Options

In the rare case you need to individually select a language subset and not utilize the CSS unicode-range selector, you may specify the import as follows. This is especially not recommended for languages, such as Japanese, with a large amount of characters.

import "@fontsource/source-sans-pro/latin-ext.css" // All weights with normal style included.
import "@fontsource/source-sans-pro/cyrillic-ext-500.css" // Weight 500 with normal style.
import "@fontsource/source-sans-pro/greek-900-normal.css" // Italic variant.
  • Supported subsets: [cyrillic,cyrillic-ext,greek,greek-ext,latin,latin-ext,vietnamese]

Licensing

It is important to always read the license for every font that you use. Most of the fonts in the collection use the SIL Open Font License, v1.1. Some fonts use the Apache 2 license. The Ubuntu fonts use the Ubuntu Font License v1.0.

Google Fonts License Attributions

Other Notes

Font version (provided by source): v14.

Feel free to star and contribute new ideas to this repository that aim to improve the performance of font loading, as well as expanding the existing library we already have. Any suggestions or ideas can be voiced via an issue.

changelog

Changelog

Fontsource will log all notable changes within this file.

Patch (0.0.x)

These occur when an automatic update is pushed from a source, such as Google, or Fontsource may apply patches. Due to version mismatching and lack of accurate tracking, a specific version for a Fontsource patch cannot be logged into the changelog. Note that Google may push breaking changes on their end to individual fonts which Fontsource cannot predict for.

Minor (0.x.x)

These will always contain changes from Fontsource's end.

4.x Release

4.0.x

BREAKING CHANGES

  • Package names have been renamed from fontsource-<font name> to the safer, more authentic scoped format @fontsource/<font name>. That means all packages will need to be reinstalled with yarn add @fontsource/<font name> or npm install @fontsource/<font name> with imports updated to the new package such as import @fontsource/open-sans/400-italic.css. #108

  • import @fontsource/<font name>/<weight> now only contains normal style variants of fonts. The -normal.css files throughout the respository have been removed. Importing italic variants remain the same via import @fontsource/<font name>/<weight>-italic.css. Please see #88 for more details. #112

Features

  • All non-Google fonts now have weight specific files that match 3.0.x as they previously were only importable via subsets. Simply use as normal with import @fontsource/<font name>/<weight>.css. #92 #115

3.x Release

3.1.x

Features

  • Initial variable font support for Google Fonts. Supported fonts can be found here with their package README's explaining installation instructions. #103

Fixes

  • Resolve incorrect filename generation for oblique/slnt variable fonts. #106 #109
  • Prevent full variant variable CSS files to be generated for fonts that do not have any extra axes. #110

3.0.x

BREAKING CHANGES

  • import fontsource-<font name> or index.css no longer defaults to contain ALL weights and styles for a font. It now only contains weight 400 with all styles included. This was changed to prevent fonts, such as Noto Sans JP, to counter-intuitively generate 1MB+ CSS files with the new unicode-range feature. Simply choose the necessary weights and styles from now on with import fontsource-<font name>/<weight>.css or import fontsource-<font name>/<weight>-<style>.css. #37 #42

  • TTF/OTF support has been removed due to NPM package size limitations. Browser compatability goes as low as: caniuse #44

Features

  • Added unicode-range CSS selector to all fonts. It is no longer necessary for individual subsets to be defined when importing CSS files but backwards compatability remains. Use import fontsource-<font name>/<weight>.css or import fontsource-<font name>/<weight>-<style>.css to leverage the new feature from now on. #37
  • Added package.json rebuilder. #43
  • Added force rebuild to Google packages. #37
  • Added force rebuild to non-Google packages. #42
  • Autogenerate FONTLIST.md and added FONTLIST.json. #58
  • Copy CHANGELOG.md to every individual package. #41

Fixes

  • Adjusted templates.js to add more relevant fields to package.json #37
  • Resolved subsets not correctly being identified when packaging files through the generic packager. #45

2.x Release

2.2.x

Features

Fixes

  • Add Yarn resolution to resolve Lerna publish errors. f6e7b1f

2.1.x

Features

  • Added metadata.json files to each package that contains useful data that allows Fontsource or external users to leverage to pull information from. #26 #27 #28
  • Account for rare possible instance of oblique font-style #26

Fixes

  • Correct src: locals() in CSS generation to reflect upstream source accurately. #10 #11
  • Resolve incorrect SCSS documentation + general improvements #23
  • Ensure no old files remain from a font update #24
  • Allow index.css generation for fonts without latin subset #25

2.0.x

  • Main release.