cfs

css-face-string

Generate a css string with font-face declaration from JS data

Showing:

Popularity

Downloads/wk

3

GitHub Stars

0

Maintenance

Last Commit

7yrs ago

Contributors

0

Package

Dependencies

0

Size (min+gzip)

0.4KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

css-face-string

Generate a css string with font-face declaration from JS data.

Useful for generating font faces programatically. Works in node.js and the browser.

Useful with browserify and insert-css

Use

var cfs = require('css-face-string')

cfs.file({
  name: 'Inconsolata',
  files: [{ url: './inconsolata.ttf', format: 'truetype' }
        ,{ url: './inconsolata.woff', format: 'woff' }]
})
//> @font-face {font-family: "Inconsolata";src: url("./inconsolata.ttf") format("truetype"), url("./inconsolata.woff") format("woff");

cfs.url("http://fonts.googleapis.com/css?family=Averia+Sans+Libre:400,300italic,700")
//> @import url(http://fonts.googleapis.com/css?family=Averia+Sans+Libre:400,300italic,700);

// No sugar:
cfs(cfs.types.FILE, {
  name: 'Inconsolata',
  files: [{ url: './inconsolata.ttf', format: 'truetype' }]
})

cfs(cfs.types.URL,
    "http://fonts.googleapis.com/css?family=Averia+Sans+Libre:400,300italic,700")

npm install --save css-face-string

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100