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

crop-awesome

v0.9.22

Published

Font Awesome kind of minifier. Crop Font Awesome files making your css bundle and fonts much smaller

Downloads

18

Readme

Crop-awesome

If you are familiar with Font Awesome, you may find this package extremely usefull for you :) Crop awesome is a simplest way to crop fonts and css files as to make them much smaller, removing unneeded icons and classes from CSS file and glyphs from font files. You can use crop-awesome in many ways because of it flexibility, we are going to go through all of them :)

First let's make an install having executed one of the command below in your terminal.

npm install crop-awesome You can install it globally using -g flag as well or git clone https://github.com/CyberCookie/crop-awesome

Crop-awesome installed globally or installed via git uses params and terminal prompt as to construct your config when crop-awesome installed as a package dependency uses passed in object that merges with the default config.

Tool execution params

--no-log - turns off info logs

-css-dest= - relative css destination

-font-dest= - relative destination for the font files

-cfg-path= - relative path to an extrnal config file. File must be have json or js format

Package default config

    {
        __logs: true,
        css_dest: './crop-awesome.css',
        font_dest: './',
        font_types: [],
        icons: [],
        help_classes: ['lg', '2x', '3x', '4x', '5x', 'fw', 'border'],
        css_font_path: ''
    }

__logs - if false prevents info and warning console outputs

css_dest - relative destination to the cropped CSS file. In dependency package mode css_dest returns as result along with CSS content

font-dest - relative destination to the font files

css_font_path - relative path inside CSS file that uses as a reference to the font files. By default it's equal to relative path between css_dest and font-dest.

font_types - types of font you want to get as a result of pacakge execution. There are six font types you are capable to choose: EOT, TTF, SVG, WOFF, WOFF2 and OTF. Since OTF is a binary font it can't be cropped, specifying it in your config will just copy original OTF file to font-dest

icons - font icons you want to include in generated CSS and font files. You can ommit fa- prefix. Since Font Awesome has aliases for some of the icons - you can use any alias/name you want in your passing config.

help_classes - helper classes such as 2x, border and so on. I've included the most usefull classes in default set. It includes lg, 2x, 3x, 4x, 5x, fw, border

Examples

crop-awesome -css-dest=./my_cropped.css -font-dest=./fonts/ In example above we see the params that set destination to CSS and font files (-css-dest, -font-dest). In case you omit a params - package get missed properties from the default config, This way of usasge also includes terminal propmt questions in order to build user config. Your answers stores in package therefore you can "autocomplete" them next time.

So far autocomplete doesn't work in global module

This is an example of how crop-awesome works being a package dependency

const fs = require('fs'),
    crop = require('crop-awesome');

crop({
    font_types: ['woff2'],
    output_path: './lol.css',
    icons: ['glass', 'space', 'infinity', 'taxi']
}).then(
    res => {
        fs.wrireFile(res.output_path, res.css, err => console.log(err))
    },
    err => console.log(err)
)

Any improvements are welcomed :)