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 with filenames in snake_case, but they are used in Django templates with kebab-case.
<!-- 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] [--kebab] icon_reference
Generate Django component SVG files from Iconify JSON files.
positional arguments:
icon_reference Icon set prefix (e.g., "brandico") or full reference with icon (e.g. "brandico:facebook")
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)
--kebab, -k Use kebab-case for filenames (default is snake_case)
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 />
Use kebab-case filenames (original iconify format)
Use the -k or --kebab flag to generate filenames with hyphens instead of underscores:
cotton-iconify heroicons --kebab
Usage in Template:
<c-heroicons.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.
Metadata
Release files for cotton-iconify 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cotton_iconify-0.1.2.tar.gz | 37.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cotton_iconify-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 47.8 kB
Release files / cotton_iconify-0.1.2.tar.gz
| Download URL | cotton_iconify-0.1.2.tar.gz |
|---|---|
| Size | 37.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b3bcb20e9b4449d2cabbb1ef2fe4d820e7c5d32d24cb9278dfeedb3cf53e31a
|
|
BLAKE2b-256 checksum How to use checksums |
bde9cda17b57f8dfa6d6cd265d64136779fa4af304e5e583a55fed8e8f130fd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2025.
Transparency logRelease files / cotton_iconify-0.1.2-py3-none-any.whl
| Download URL | cotton_iconify-0.1.2-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
98a749e0cc74318445e93274bcf7cc8622375d4f231f54428a8744f663366beb
|
|
BLAKE2b-256 checksum How to use checksums |
fdce4e11786653494cbe647576cb5777c8a970453d3c13236c99a92baf1d3b96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2025.
Transparency log