Skip to content

Commit 220f325

Browse files
refactor icon installation by simplifying hook (#50)
1 parent 7bf3c2f commit 220f325

File tree

5 files changed

+7
-59
lines changed

5 files changed

+7
-59
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/
3838
- Now using `nox` for testing.
3939
- Build script has been moved from inside the package to the root of the repository.
4040
- Added link to MIT license in all SVG files and split the license and Refactoring UI Inc. copyright information into separate lines.
41+
- Icon registration has been simplified to just getting a list of the icon files under the `heroicons` template directory.
4142

4243
### Removed
4344

4445
- Dropped support for Python 3.7.
4546
- Removed all build scripts and related methods from package.
47+
- Removed `icons.py` and associated tests.
4648

4749
## [0.1.3]
4850

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ exclude_lines = [
7979
"if TYPE_CHECKING:",
8080
'def __str__\(self\)\s?\-?\>?\s?\w*\:'
8181
]
82-
fail_under = 60
8382

8483
[tool.coverage.run]
8584
branch = true

src/wagtail_heroicons/icons.py

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
from __future__ import annotations
22

3-
try:
4-
from wagtail import hooks
5-
except ImportError:
6-
from wagtail.core import hooks
3+
from pathlib import Path
74

8-
from .icons import Heroicon
5+
from wagtail import hooks
96

107

118
@hooks.register("register_icons")
129
def register_icons(icons):
13-
for icon in Heroicon.get_icons():
14-
icons.append(str(icon.path))
15-
return icons
10+
template_dir = Path(__file__).parent / "templates" / "heroicons"
11+
heroicons = [file.stem for file in template_dir.glob("*.svg")]
12+
return icons + heroicons

tests/test_icons.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)