# iso-3166-1-flags-sprite-generator

> iso-3166-1 country flags css sprite generator

Latest version **1.1.0** (published 2022-07-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install iso-3166-1-flags-sprite-generator
pnpm add iso-3166-1-flags-sprite-generator
yarn add iso-3166-1-flags-sprite-generator
bun add iso-3166-1-flags-sprite-generator
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2022-07-08 |
| First published | 2022-07-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 642.6 KB |
| Known vulnerabilities | 0 (+4 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ben Meyrick |
| Maintainers | bameyrick |
| Keywords | Flags, ISO-3166-1, ISO-3166-2, Flag, Country, Countries, PNG, Sprite, css, alpha-2, Alpha2, generator, spritesheet |

## Links

- npm: https://www.npmjs.com/package/iso-3166-1-flags-sprite-generator
- Repository: https://github.com/bameyrick/iso-3166-1-flags-sprite-generator
- Homepage: https://github.com/bameyrick/iso-3166-1-flags-sprite-generator#readme
- Issues: https://github.com/bameyrick/iso-3166-1-flags-sprite-generator/issues
- npm.io page: https://npm.io/package/iso-3166-1-flags-sprite-generator

## Dependencies (3)

- [glob](https://npm.io/package/glob.md) ^8.0.3
- [sharp](https://npm.io/package/sharp.md) ^0.30.7
- [spritesmith](https://npm.io/package/spritesmith.md) ^3.4.0

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2022-07-08
- 1.0.0 — 2022-07-08

## README

# ISO-3166-1 Flags Generator

Generate a css sprite for iso-3166-1 country flags

[![GitHub release](https://img.shields.io/github/release/bameyrick/iso-3166-1-flags-sprite-generator.svg)](https://github.com/bameyrick/iso-3166-1-flags-sprite-generator/releases)
[![Build Status](https://travis-ci.com/bameyrick/iso-3166-1-flags-sprite-generator.svg?branch=main)](https://travis-ci.com/github/bameyrick/iso-3166-1-flags-sprite-generator)
[![codecov](https://codecov.io/gh/bameyrick/iso-3166-1-flags-sprite-generator/branch/main/graph/badge.svg)](https://codecov.io/gh/bameyrick/iso-3166-1-flags-sprite-generator)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/db81c43235c14f0db58a66dc07f161cc)](https://www.codacy.com/manual/bameyrick/iso-3166-1-flags-sprite-generator)

- [ISO-3166-1 Flags Generator](#iso-3166-1-flags-generator)
  - [Install](#install)
    - [npm](#npm)
    - [yarn](#yarn)
  - [Documentation](#documentation)
  - [Usage](#usage)
  - [Options](#options)
    - [Available options](#available-options)

## Install

You can install via npm or yarn.

### npm

```bash
npm install --save iso-3166-1-flags-sprite-generator
```

### yarn

```bash
yarn add iso-3166-1-flags-sprite-generator
```

## Documentation

This documentation is written in TypeScript, however this library works fine in vanilla JavaScript too.

## Usage

```typescript
import createFlagSprite from 'iso-3166-1-flags-sprite-generator';

async function myFn(): Promise<void> {
  await createFlagSprite('assets/img', 'styles');
}
```

## Options

Options can be provided to the method as the third argument

```typescript
import createFlagSprite from 'iso-3166-1-flags-sprite-generator';

async function myFn(): Promise<void> {
  await createFlagSprite('assets/img', 'styles', { width: 120, center: false });
}
```

### Available options

| Option            | Type    | description                                                                                            | Default value                       |
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------ | ----------------------------------- |
| center            | boolean | Whether to center the flag horizontally                                                                | true                                |
| classPrefix       | string  | Prefix for css classes                                                                                 | flag                                |
| cssFileName       | string  | Name for the generated css file                                                                        | flags                               |
| demo              | boolean | Whether to create a demo file                                                                          | true                                |
| demoDestination   | string  | Destination for the demo html file. Will have no affect if demo is set to false                        | flags-demo                          |
| dimensionsClasses | boolean | Whether to add dimensions classes                                                                      | false                               |
| dimensionsSuffix  | string  | Suffix for dimensions classes                                                                          | dims                                |
| lowecaseAlpha2    | boolean | Whether to set the alpha2 code in the css classnames to lowercase                                      | false                               |
| spriteFileName    | string  | Name for the generated sprite png file                                                                 | flag-sprite                         |
| spriteUrl         | string  | Background url for the sprite (excluding the file name)                                                | same as provided sprite destination |
| width             | number  | Maximum width of the flags. Note, all flags will be the same height but not necessarily the same width | 60                                  |
| silent            | boolean | Whether to suppress logging                                                                            | false                               |

---
_Source: https://npm.io/package/iso-3166-1-flags-sprite-generator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
