Skip to main content

Generate iconify icons as django-cotton components.

Project description

cotton-iconify

CLI tool to generate iconify icons as django-cotton components

Generate full icon-sets or single icons into your Django project as ready-to-use cotton components. See iconify for available icons and icon-sets.

Installation

Install via pip:

pip install cotton-iconify

Or via uv as development dependency:

uv add cotton-iconify --dev

Get started

Generate an icon-set

cotton-iconify heroicons

Generate a single icon

cotton-iconify heroicons check-circle

Use as cotton component in Django templates:

<c-heroicons.check-circle />

Usage

By default, icons will be created in the templates/cotton/<icon-set> directory.

<!-- example output in templates/cotton/heroicons/check-circle.html -->

<c-vars width="1000" height="1000" viewBox="0 0 1000 1000" />

<svg {{ attrs }} xmlns="http://www.w3.org/2000/svg" width="{{ width }}" height="{{ height }}" viewBox="{{ viewBox }}">
  <path fill="currentColor" d="M0 791.667h694.444L1000 208.333H333.334z"/>
</svg>

Basic usage in Django templates:

<c-heroicons.check-circle />

Pass attributes

<c-heroicons.check-circle class="icon foo" bar />

Modify width/height/viewBox attributes of svg:

<c-heroicons.check-circle width="16" height="16" viewBox="0 0 16 16" />

Generation Options

usage: cotton-iconify [-h] [--all] [--output OUTPUT] [--source SOURCE] [--force] [--file-prefix FILE_PREFIX] prefix [icon]

Generate Django component SVG files from Iconify JSON files.

positional arguments:
  prefix                Icon set prefix (e.g., "brandico" for brandico.json)
  icon                  Optional: specific icon name to generate

options:
  -h, --help            show this help message and exit
  --all, -a             Generate all icons from the set
  --output OUTPUT, -o OUTPUT
                        Output directory for SVG files (if not specified, uses templates/cotton/<icon-set>)
  --source SOURCE, -s SOURCE
                        Source URL for JSON files
  --force, -f           Overwrite existing files without asking
  --file-prefix FILE_PREFIX, -p FILE_PREFIX
                        Prefix to add to generated filenames (e.g., "icon" for icon-name.html)

Specify Output directory

Provide a directory path with -o or --output

cotton-iconify heroicons -o templates/cotton/icons

Usage in Template:

<c-icons.check-circle />

Specify prefix for output files

Provide a file prefix with -p or --file-prefix. This option is useful for generating icons from multiple icon-sets into one output folder.

cotton-iconify heroicons -p hero -o templates/cotton/icons

Usage in Template:

<c-icons.hero-check-circle />

Acknowledgement

cotton-iconify is built upon the incredible work of Iconify and django-cotton. While cotton-iconify is not officially affiliated with Iconify or django-cotton, we deeply appreciate their contributions to the open-source community, which made this tool possible.

License

cotton-iconify is licensed under the MIT license.

This license does not apply to icons. Icons are released under different licenses, see each icon set for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cotton_iconify-0.1.0.tar.gz (36.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cotton_iconify-0.1.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file cotton_iconify-0.1.0.tar.gz.

File metadata

  • Download URL: cotton_iconify-0.1.0.tar.gz
  • Upload date:
  • Size: 36.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cotton_iconify-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ebd1e368a10e79e950621f62c06b0ae7e0216d9da1c6d18d729601a2a4f283d6
MD5 8c7f451ce6fea03e629596a74e274086
BLAKE2b-256 05357daffa0f150d83cc3d935a403c9fae2f428b88f2428e570fc1cf5b16dcc9

See more details on using hashes here.

Provenance

The following attestation bundles were made for cotton_iconify-0.1.0.tar.gz:

Publisher: publish.yml on nklsw/cotton-iconify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cotton_iconify-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cotton_iconify-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cotton_iconify-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6867b452c8bdbf5704880707317344c0453b4c43c5935ee616ccabdf11d90104
MD5 2fc6bbf181423ae53f8136b5a2a6ba31
BLAKE2b-256 50abf8c5f7086546df96190820189d5a43ee5f086c804975b629a91b6a246c7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cotton_iconify-0.1.0-py3-none-any.whl:

Publisher: publish.yml on nklsw/cotton-iconify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page