neue

1.0.0 • Public • Published

neue

Build Status

A minimal web font loader

Async loading of linked fonts with @font-face.

Installation

Install with npm:

$ npm install neue

Downloads

Usage

Load font families using FVD-style declarations:

neue.load([
    { families: ['Source Sans Pro:n2,n3,n4,n6,n7,n9'], css: '//fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900' }
], function(err){
    // fonts are ready!
})

Where the CSS file looks like this:

@font-face {
    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 200;
    src: ...
}
@font-face {
    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 300;
    src: ...
}
@font-face {
    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 400;
    src: ...
}
@font-face {
    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 600;
    src: ...
}
@font-face {
    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 700;
    src: ...
}
@font-face {
    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 900;
    src: ...
}

Utilities

parse

neue.parse('Source Sans Pro:n2') // { family: 'Source Sans Pro', variations: ['n2'] }

stringify

neue.stringify('Source Sans Pro:n2') // ['source-sans-pro-n2']

Example

Run the example server at http://127.0.0.1:3000:

$ npm run example-server

Tests

Run the test server at http://127.0.0.1:8000:

$ grunt test:dev

Builds

Create standalone dist/neue.js and dist/neue.min.js builds:

$ grunt dist

License

MIT License, see LICENSE for details.

Readme

Keywords

Package Sidebar

Install

npm i neue

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • christophercliff