iso-3166-1-flags-sprite-generator
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

ISO-3166-1 Flags Generator

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

GitHub release Build Status codecov Codacy Badge

Install

You can install via npm or yarn.

npm

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

yarn

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

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

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    14
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    14
  • 1.0.0
    12

Package Sidebar

Install

npm i iso-3166-1-flags-sprite-generator

Weekly Downloads

26

Version

1.1.0

License

MIT

Unpacked Size

658 kB

Total Files

270

Last publish

Collaborators

  • bameyrick