Skip to content

encukou/bytesize-to-jinja

Repository files navigation

Bytesize to Jinja

This is a simple tool to convert Dan Klammer's Bytesize Icons to a Jinja2 macro.

Bytesize Icons are tiny SVG-based icons intended to be embedded directly in HTML pages, and styled with CSS.

Jinja2 is a popular templating engine for Python.

For convenience, the resulting macro is included in this repository. (It might be outdated, though – check the Bytesize site for updates.)

Using the Icons

In your Jinja template, grab the file with the macro, then import and use it:

{% from "bytesize_icons.jinja" import bytesize_icon %}

{{ bytesize_icon('heart') }}

Running the Script

If you want to regenerate the macro, you will need Python 3.6+. If you have GNU make, just run that:

$ make

Or, do the steps manually:

If you did this because the included macro is outdated, consider sending a pull request for bytesize-to-jinja. Thanks!

License

The icons are under a MIT license. According to the project's README:

Bytesize Icons does not require attribution, but is encouraged. A link or mention anywhere in your project would be much appreciated.

The conversion script is given away under the CC0 Public Domain Dedication. May it serve you well.