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 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cotton_iconify-0.1.2.tar.gz.
File metadata
- Download URL: cotton_iconify-0.1.2.tar.gz
- Upload date:
- Size: 37.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b3bcb20e9b4449d2cabbb1ef2fe4d820e7c5d32d24cb9278dfeedb3cf53e31a
|
|
| MD5 |
df40d43368b47951c84e3e348b1076db
|
|
| BLAKE2b-256 |
bde9cda17b57f8dfa6d6cd265d64136779fa4af304e5e583a55fed8e8f130fd0
|
Provenance
The following attestation bundles were made for cotton_iconify-0.1.2.tar.gz:
Publisher:
publish.yml on nklsw/cotton-iconify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cotton_iconify-0.1.2.tar.gz -
Subject digest:
4b3bcb20e9b4449d2cabbb1ef2fe4d820e7c5d32d24cb9278dfeedb3cf53e31a - Sigstore transparency entry: 202114495
- Sigstore integration time:
-
Permalink:
nklsw/cotton-iconify@63f7304725a09e3cca3e04f5d6de694a093417e1 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/nklsw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@63f7304725a09e3cca3e04f5d6de694a093417e1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cotton_iconify-0.1.2-py3-none-any.whl.
File metadata
- Download URL: cotton_iconify-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98a749e0cc74318445e93274bcf7cc8622375d4f231f54428a8744f663366beb
|
|
| MD5 |
5495dd979e0fed6eb476e88528efe54b
|
|
| BLAKE2b-256 |
fdce4e11786653494cbe647576cb5777c8a970453d3c13236c99a92baf1d3b96
|
Provenance
The following attestation bundles were made for cotton_iconify-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on nklsw/cotton-iconify
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cotton_iconify-0.1.2-py3-none-any.whl -
Subject digest:
98a749e0cc74318445e93274bcf7cc8622375d4f231f54428a8744f663366beb - Sigstore transparency entry: 202114498
- Sigstore integration time:
-
Permalink:
nklsw/cotton-iconify@63f7304725a09e3cca3e04f5d6de694a093417e1 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/nklsw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@63f7304725a09e3cca3e04f5d6de694a093417e1 -
Trigger Event:
release
-
Statement type: