# ttf-loader

> The simplest font loading using webpack available

Latest version **1.0.2** (published 2018-01-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install ttf-loader
pnpm add ttf-loader
yarn add ttf-loader
bun add ttf-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-01-24 |
| First published | 2018-01-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Yuval Saraf |
| Maintainers | unimonkiez |
| Keywords | font, js, loader, ttf, webpack |

## Links

- npm: https://www.npmjs.com/package/ttf-loader
- Repository: https://github.com/unimonkiez/ttf-loader
- Homepage: https://github.com/unimonkiez/ttf-loader#readme
- Issues: https://github.com/unimonkiez/ttf-loader/issues
- npm.io page: https://npm.io/package/ttf-loader

## Dependencies (4)

- [jss](https://npm.io/package/jss.md) ^9.5.1
- [uuid](https://npm.io/package/uuid.md) ^3.2.1
- [ttf2woff](https://npm.io/package/ttf2woff.md) ^2.0.1
- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.26.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-01-24
- 1.0.1 — 2018-01-24
- 1.0.0 — 2018-01-24

## README

# ttf-loader
[![npm version](https://badge.fury.io/js/ttf-loader.svg)](https://badge.fury.io/js/ttf-loader)[![Build Status](https://travis-ci.org/unimonkiez/ttf-loader.svg?branch=master)](https://travis-ci.org/unimonkiez/ttf-loader)

## Import and use fonts easily in your javascript web app

## Usage
* Install
  ```bash
  # file-loader is peerDependency
  npm install --save-dev ttf-loader file-loader
  # or yarn
  yarn add -D ttf-loader file-loader
  ```
* Add loader to your `webpack-config`
  ```js
  ...
   module: {
      rules: [
        {
            test: /\.ttf$/,
            use: [
              {
                loader: 'ttf-loader',
                options: {
                  name: './font/[hash].[ext]',
                },
              },
            ]
        }
      ]
   }
  ```
* Import ttfs and use them in your code!
  * Inline
  ```jsx
  import React, { Component } from 'react';
  import someFontFamily from 'some.ttf';
  
  export default class App extends Component {
    render() {
      return (
        <div style={{ fontFamily: someFontFamily }}>
          <span>
            Welcome to my React app!
          </span>
        </div>
      );
    }
  }
  ```
  * jss
  ```jsx
  import React, { Component } from 'react';
  import jss from 'jss';
  import someFontFamily from 'some.ttf';

  const spanClass = jss.createStyleSheet({
    span: {
      'font-family': someFontFamily,
    },
  }).attach().classes.span;
  
  export default class App extends Component {
    render() {
      return (
        <div className={spanClass}>
          <span>
            Welcome to my React app!
          </span>
        </div>
      );
    }
  }
  ```

---
_Source: https://npm.io/package/ttf-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
