sveetch / django-icomoon Goto Github PK
View Code? Open in Web Editor NEWA Django app to deploy webfonts from Icomoon and display them
License: MIT License
A Django app to deploy webfonts from Icomoon and display them
License: MIT License
There is at least one issue with basestring usage in manifest parser, time to add unittest to cover django and python versions
Here:
https://github.com/sveetch/django-icomoon/blob/master/icomoon/templates/icomoon/icon_map.scss#L5
We should quote the item name to avoid conflict with reserved keyword.
Sass template use icon attribute class_name
that already starts with 'icon-' so it results to something like $icon-icon-name
instead of $icon-name
.
Since version 59 fail to install a package which have a short description with empty newline, like here the short desc comes from:
https://github.com/sveetch/django-icomoon/blob/master/icomoon/__init__.py#L1
It should be instead:
"""A Django app to deploy wefonts from Icomoon and display them"""
Currently, projects which want to install this package need to pin setuptools version to <59
Manage command is not compatible with django>=1.10, this is to resolve.
Actually font name is hardcoded to "icomoon", so font with a custom name cannot be managed.
I've have successfully runned quality tasks with Django 4.0 so the app seems safe up to this version.
Just need to update tox config, run it then update setup.cfg and doc about Django support.
Seems safe since 1.0 version, so just use this minimal version requirement and it will be more safe to use in other projects.
Actually this view is in "login required" mode only, this should be optional from settings.
Reported from an usage on some recent project with Django 1.8 :
mycomputer:someproject Emencia$ make icomoon
usage: django-instance icomoon_deploy [-h] [--version] [-v {0,1,2,3}]
[--settings SETTINGS]
[--pythonpath PYTHONPATH] [--traceback]
[--no-color]
django-instance icomoon_deploy: error: unrecognized arguments: Default icomoon.zip
make: *** [icomoon] Error 2
mycomputer:someproject Emencia$
Sometime a icon item from icomoon can have an invalid name like foo, bar
because of its tags, and it should be something like foo
, bar
or foobar
but never something we invalid characters for a Sass variables (no space, no ,
, no $
, etc..).
At least, the command line should validate each name and raise a warning or a blocking error when there is some invalid name.
This is to avoid unexpected issues with generated Sass map for users which forgot about the valid variable name requirement.
Change template for something like:
{% for icon_name,icon_values in icons.items %}${{ icon_values.class_name }}: "{{ icon_values.utf8 }}";
{% endfor %}
$icons: (
{% for icon_name,icon_values in icons.items %}{{ icon_values.class_name }}: ${{ icon_values.class_name }},
{% endfor %}
);
@mixin include-icons(){
@each $name, $value in $icons {
.#{% templatetag openbrace %}$name{% templatetag closebrace %}::before {
content: "#{% templatetag openbrace %}$value{% templatetag closebrace %}";
}
}
}
This will be usefull to directly include icons in element rules without use @extend
.
Dont know exactly how to expose them so they can be used project settings without more complex installation procedure.
Once done, a mixin could be added to create every properties needed to add icon (not only the icon character, but also font-family and stuff). But this may not fit in django-icomoon because it's sass stuff.
A really usefull feature would be a command line action to automatically deploy stuff from download webfont archive on Icomoon.
So the CLI action should take a path to the zip archive then open it (in temporary dir), put the manifest and font files to the right directory, then finally generate the scss file which contains the icon map.
Actually the only part that is not tested.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.