npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

broccoli-sass-font-face

v0.0.1

Published

@font-face generator for broccoli

Downloads

1

Readme

broccoli-sass-font-face

This is a broccoli plugin for the easy generation of @font-face rules.

Installation

npm install --save-dev broccoli-sass-font-face

Usage

Assume that you have several fonts in your project's webpub/fonts directory:

~/project/$ ls -C webpub/fonts
headers.eot
headers.ttf
headers.woff
headers_bold.eot
headers_bold.ttf
headers_bold.woff

Add in your Brocfile.js

var fontFace = require( 'broccoli-sass-font-face' );
// This prefix will be removed from the each font URL:
fontFace.font_root = 'webpub';

var fonts = fontFace( 'webpub/fonts', {
    // Specify location of the file with Sass mixins and variables for our fonts:
    output: 'scss_compiled/_fonts.scss',
});

// ... then pass this tree to the broccoli Sass plugin

The output file will contain something like this (you can see this if you export the fonts tree):

// File created with broccoli-sass-font-face at Mon Dec 22 2014 20:08:01 GMT+0700 (NOVT)


@mixin headers_font{
    @font-face{
        font-family: "ObelixPro Regular";
        src: url('/fonts/headers.eot');
        src: url('/fonts/headers.eot?#iefix') format('embedded-opentype'),
             url('/fonts/headers.ttf') format('truetype'),
             url('/fonts/headers.woff') format('woff');
        font-weight: normal;
        font-style: normal;
    }
}
$headers_font_family: "ObelixPro Regular";

@mixin headers_bold_font{
    @font-face{
        font-family: "ObelixPro Bold";
        src: url('/fonts/headers_bold.eot');
        src: url('/fonts/headers_bold.eot?#iefix') format('embedded-opentype'),
             url('/fonts/headers_bold.ttf') format('truetype'),
             url('/fonts/headers_bold.woff') format('woff');
        font-weight: normal;
        font-style: normal;
    }
}
$headers_bold_font_family: "ObelixPro Bold";

Generated mixins and variables can be imported in your Sass file as follows:

@import "scss_compiled/fonts";

@include headers_font;

h1, h2, h3, h4{
    font-family: $headers_font_family
}

If you pass to plugin a broccoli tree as first argument, you must to set a font_dir option. If you want to include automatically all generated mixins, you can set an include option to true.

Documentation

fontFace( inputTree, options )


options.output {String}

Location of the output file with Sass mixins and variables.


[options.font_dir] {String|null}

A path to the directory with fonts. Required, when the inputTree is a broccoli tree, returned by another plugin.

Default value: null


[options.font_root] {String|null}

A prefix which must be cut out from the each font URL

Default value: null


[options.include] {Boolean}

If is set to true, all generated mixins will be automatically included.

Default value: false

Important notes

  • Supported font formats: TTF, WOFF, WOFF2, EOT. SVG fonts are deprecated and are not supported.
  • Plugin takes the value for the font-family property only from ttf files for now. If the ttf file is not present for the group of fonts, the value will be a file basename.

License

This project is distributed under the MIT license.