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

@mapmelabs/icomoon-builder

v2.0.0

Published

Update your icons library project from the zip generated by icomoon

Downloads

7

Readme

icomoon-builder

Build Status npm npm

Update your icons library project from the zip generated by icomoon.

Fork from the original icomoon-builder project with a more flexible CLI API.

Currently working only for CSS and SASS.

If you are developing your own icons library using the Icomoon tool and you find yourself doing the below process all the time this project might be useful for you.

Normal process

  1. Download the zip file from icomoon.
  2. Uncompressing it.
  3. Copy pasting parts of code into your own.
  4. Moving files to the location you want.
  5. Minify the css file.

Process with icomoon-builder

  1. Download the font from icomoon.
  2. Run icomoon-builder.

Features

  • Uncompress the icomoon generated zip file for you.
  • Pick the location where the fonts styles will be moved.
  • Choose where to move the pre-processed and css styles separately.
  • All references between all these files will be updated accordingly.
  • Minify the distribution css with cssnano.
  • Update the font family name with the one you chose.
  • Will keep your selection.json generated by icomoon so you can resume your work.
  • And many more (below examples).

Installation

npm install --save-dev icomoon-builder

Usage

You can run it directly in your terminal with npx (included in npm since version 5.2):

npx icomoon-builder export <fontName> <icomoonZipFile>

Or add it as a script in your package.json:

"scripts": {
    "import": "icomoon-builder export"
}

And then run it:

npm run import <fontName> <icomoonZipFile>

Options

You can control which files are copied with some additional flags:

  • --css <path> : copies the CSS file to this path.
  • --css-name <name> : rename CSS file to the value of this flag.
  • --docs <path> : copies the docs to this path.
  • --fonts <path> : copies the font files to this path.
  • --fonts-public <path> : changes fonts path in the CSS file to this path.
  • --force : execute without confirmation.
  • --json <path> : copy the JSON file to this path.
  • --no-minify : skip CSS minification.
  • --preprocessor <path> : copy the SCSS file to this path.

Any flag that's not used in will result in such file not to be copied. (Note: this differs from the previous version which required all parameters to be passed in.)

Examples

Export

Considering the following files are the ones icomoon generates and compresses:

.tmp/
├── demo-files
|   ├── demo.css
|   └── demo.js
├── demo.html
├── fonts
|   ├── icomoon.svg
|   ├── icomoon.ttf
|   └── icomoon.woff
├── Read Me.txt
├── selection.json
├── style.css
├── style.scss
└── variables.scss

When running:

cd your/path/to/fancy-icons-project/
npx icomoon-builder export fancy-icons ~/Downloads/icomoon.zip --preprocessor=scss --css=css --fonts=fonts --docs=docs --json=./

We will obtain:

target/
├── css
|   ├── fancy-icons.css
|   └── fancy-icons.min.css
├── docs
|   ├── index.html
|   ├── scripts.js
|   └── styles.css
├── fonts
|   ├── fancy-icons.svg
|   ├── fancy-icons.ttf
|   └── fancy-icons.woff
└── scss
|   ├── fancy-icons.scss
|   ├── _icons.scss
|   └── _variables.scss
└── icomoon.json

The export command does not destroy directories so if you have more files in the destination folders they will remain the same.

The following is the list of files copied:

| From | To | Operations performed | | -------------------------- | ------------------------------------------- | ------------------------------------------------------------------ | | .tmp/demo.html | fancy-icons-project/docs/index.html | Updated references to assets | | .tmp/demo-files/demo.css | fancy-icons-project/docs/styles.css | | | .tmp/demo-files/demo.js | fancy-icons-project/docs/scripts.js | | | .tmp/selection.json | fancy-icons-project/icomoon.json | Renamed to icomoon.json | | .tmp/style.css | fancy-icons-project/css/fancy-icons.css | Renamed to <fontName>, updated references | | | fancy-icons-project/css/fancy-icons.min.css | Minify the previous css | | .tmp/fonts/line-icons.woff | fancy-icons-project/fonts/fancy-icons.woff | Renamed to <fontName> | | .tmp/fonts/line-icons.svg | fancy-icons-project/fonts/fancy-icons.svg | Renamed to <fontName> | | .tmp/fonts/line-icons.ttf | fancy-icons-project/fonts/fancy-icons.ttf | Renamed to <fontName> | | .tmp/style.scss | fancy-icons-project/scss/_icons.scss | Updated references and renamed $icomoon-font-path | | .tmp/variables.scss | fancy-icons-project/scss/_variables.scss | | | | fancy-icons-project/scss/fancy-icons.scss | Imports the other two scss files. Created if does not exist before |

Clean

Removes files from the specified paths.

Careful, this command is destructive and cannot be undone.

Warning: if you pass a directory, it will remove it completely, including files not copied with the export command.

Accepts the following flags:

  • --css <path> : removes the CSS file to this path.
  • --docs <path> : removes the docs to this path.
  • --fonts <path> : removes the font files to this path.
  • --force : execute without confirmation.
  • --json <path> : copy the JSON file to this path.
  • --preprocessor <path> : copy the SCSS file to this path.

Running:

cd your/path/to/fancy-icons-project/
npx icomoon-builder clean --preprocessor=scss --css=css --fonts=fonts --docs=docs

Will remove entirely the following folders:

  • your/path/to/fancy-icons-project/scss
  • your/path/to/fancy-icons-project/css
  • your/path/to/fancy-icons-project/fonts
  • your/path/to/fancy-icons-project/docs

Todo

  • [x] SASS
  • [ ] LESS
  • [ ] Stylus

License

MIT

Authors