django-staticinline


Namedjango-staticinline JSON
Version 1.6 PyPI version JSON
download
home_pagehttps://github.com/bartTC/django-staticinline
SummaryDjango template tag to load static files inline with your template.
upload_time2024-11-19 08:36:21
maintainerNone
docs_urlNone
authorMartin Mahner
requires_python<4.0,>=3.9
licenseMIT
keywords django staticfiles inline performance
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![](https://badge.fury.io/py/django-staticinline.svg)](https://badge.fury.io/py/django-staticinline)
[![](https://github.com/bartTC/django-staticinline/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/bartTC/django-staticinline/actions)

-----

📖 Full documentation: https://barttc.github.io/django-staticinline/<br/>
🐱 GitHub Repository: https://github.com/bartTC/django-staticinline


# django-staticinline

Works similar to Django's `static` template tag, but this one includes
the file directly in the template, rather than a link to it.

You can additionally post-process the file content using custom 'encoder'.

## Compatibility Matrix:

| Py/Dj     | 3.9 | 3.10 | 3.11 | 3.12 | 3.13 |
|-----------|-----|------|------|------|------|
| 4.2 (LTS) | —   | ✓    | ✓    | ✓    | ✓    |
| 5.0       | —   | ✓    | ✓    | ✓    | ✓    |
| 5.1       | —   | ✓    | ✓    | ✓    | ✓    |

## Quickstart


1. Put the StaticInlineAppConfig along your apps.

   ```python
   INSTALLED_APPS = [
       # ...
       'staticinline.apps.StaticInlineAppConfig',
   ]
   ```
   
2. Load the template tag and pass a filename as you'd do with a `static`
   template tag. You can also post-process the file content. In the example
   below we encode the content of the `mykey.pem` file with base64. Several
   encoders are already built-in, see the [Encoder docs].

   ```html
   {% load staticinline %}
   
   <style>{% staticinline "myfile.css" %}</style>
   My base64 encoded Key: {% staticinline "mykey.pem" encode="base64" cache=True %}
    ```
   
3. Enjoy the result:

   ```html
   <style>body{ color: red; }</style>
   My base64 encoded Key: LS0tIFN1cGVyIFByaXZhdGUgS2V5IC0tLQo=
   ```

[Encoder docs]: https://docs.elephant.house/django-staticinline/encoder.html

# Changelog

## v1.6 (2024-11-19)

- Python 3.13 compatibility and tests.
- Drop support for Django <= 4.1.
- Drop support for Python 3.8.

## v1.5 (2024-08-11)

- Django 5.0, 5.1 compatibility and tests.
- Python 3.12 compatibility and tests.
- Type annotations.
- Switch from pipenv to Poetry.

## v1.4 (2023-04-29)

- Django 3.2 to 4.2 compatibility and tests.
- Python 3.8 to 3.11 compatibility and tests.

## v1.3 (2018-08-15)

- Added `cache` and `cache_timeout` templatetag arguments to store rendered
  values in cache.
- Added `data_response` AppConfig method to globally override the template
  tag response.

## v1.2 (2018-08-14)

- Added support for Django 2.1 and Python 3.7.
- Added proper documentation.
- Added `sri` (Subresource Integrity) encoder to generate a sha256 for a
  given file.

## v1.1 (2018-08-09)

- Added support for custom data encoders to modify file content on the fly.
- Added `data` and `base64` encoders, both convert data into base64.

## v1.0 (2018-04-29)

- 🌟 Initial release.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bartTC/django-staticinline",
    "name": "django-staticinline",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "django, staticfiles, inline, performance",
    "author": "Martin Mahner",
    "author_email": "martin@mahner.org",
    "download_url": "https://files.pythonhosted.org/packages/f7/1e/c1180e76aa5fd14a34a6cbe076718698e9269d213adc0de189a847f7ed9a/django_staticinline-1.6.tar.gz",
    "platform": null,
    "description": "[![](https://badge.fury.io/py/django-staticinline.svg)](https://badge.fury.io/py/django-staticinline)\n[![](https://github.com/bartTC/django-staticinline/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/bartTC/django-staticinline/actions)\n\n-----\n\n\ud83d\udcd6 Full documentation: https://barttc.github.io/django-staticinline/<br/>\n\ud83d\udc31 GitHub Repository: https://github.com/bartTC/django-staticinline\n\n\n# django-staticinline\n\nWorks similar to Django's `static` template tag, but this one includes\nthe file directly in the template, rather than a link to it.\n\nYou can additionally post-process the file content using custom 'encoder'.\n\n## Compatibility Matrix:\n\n| Py/Dj     | 3.9 | 3.10 | 3.11 | 3.12 | 3.13 |\n|-----------|-----|------|------|------|------|\n| 4.2 (LTS) | \u2014   | \u2713    | \u2713    | \u2713    | \u2713    |\n| 5.0       | \u2014   | \u2713    | \u2713    | \u2713    | \u2713    |\n| 5.1       | \u2014   | \u2713    | \u2713    | \u2713    | \u2713    |\n\n## Quickstart\n\n\n1. Put the StaticInlineAppConfig along your apps.\n\n   ```python\n   INSTALLED_APPS = [\n       # ...\n       'staticinline.apps.StaticInlineAppConfig',\n   ]\n   ```\n   \n2. Load the template tag and pass a filename as you'd do with a `static`\n   template tag. You can also post-process the file content. In the example\n   below we encode the content of the `mykey.pem` file with base64. Several\n   encoders are already built-in, see the [Encoder docs].\n\n   ```html\n   {% load staticinline %}\n   \n   <style>{% staticinline \"myfile.css\" %}</style>\n   My base64 encoded Key: {% staticinline \"mykey.pem\" encode=\"base64\" cache=True %}\n    ```\n   \n3. Enjoy the result:\n\n   ```html\n   <style>body{ color: red; }</style>\n   My base64 encoded Key: LS0tIFN1cGVyIFByaXZhdGUgS2V5IC0tLQo=\n   ```\n\n[Encoder docs]: https://docs.elephant.house/django-staticinline/encoder.html\n\n# Changelog\n\n## v1.6 (2024-11-19)\n\n- Python 3.13 compatibility and tests.\n- Drop support for Django <= 4.1.\n- Drop support for Python 3.8.\n\n## v1.5 (2024-08-11)\n\n- Django 5.0, 5.1 compatibility and tests.\n- Python 3.12 compatibility and tests.\n- Type annotations.\n- Switch from pipenv to Poetry.\n\n## v1.4 (2023-04-29)\n\n- Django 3.2 to 4.2 compatibility and tests.\n- Python 3.8 to 3.11 compatibility and tests.\n\n## v1.3 (2018-08-15)\n\n- Added `cache` and `cache_timeout` templatetag arguments to store rendered\n  values in cache.\n- Added `data_response` AppConfig method to globally override the template\n  tag response.\n\n## v1.2 (2018-08-14)\n\n- Added support for Django 2.1 and Python 3.7.\n- Added proper documentation.\n- Added `sri` (Subresource Integrity) encoder to generate a sha256 for a\n  given file.\n\n## v1.1 (2018-08-09)\n\n- Added support for custom data encoders to modify file content on the fly.\n- Added `data` and `base64` encoders, both convert data into base64.\n\n## v1.0 (2018-04-29)\n\n- \ud83c\udf1f Initial release.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Django template tag to load static files inline with your template.",
    "version": "1.6",
    "project_urls": {
        "Bugtracker": "https://github.com/bartTC/django-staticinline/issues",
        "Homepage": "https://github.com/bartTC/django-staticinline",
        "Source": "https://github.com/bartTC/django-staticinline"
    },
    "split_keywords": [
        "django",
        " staticfiles",
        " inline",
        " performance"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6743596f128f3d61ed6d1b945fbcab4f7fc93a18e928bc587a93b57c657a58d2",
                "md5": "94bcdde7a028fe202384be3394fbc3bc",
                "sha256": "dab047a89093554f139e0c2139eb469f07172cf5d7551c6967378c757b120584"
            },
            "downloads": -1,
            "filename": "django_staticinline-1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "94bcdde7a028fe202384be3394fbc3bc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 10863,
            "upload_time": "2024-11-19T08:36:20",
            "upload_time_iso_8601": "2024-11-19T08:36:20.297063Z",
            "url": "https://files.pythonhosted.org/packages/67/43/596f128f3d61ed6d1b945fbcab4f7fc93a18e928bc587a93b57c657a58d2/django_staticinline-1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f71ec1180e76aa5fd14a34a6cbe076718698e9269d213adc0de189a847f7ed9a",
                "md5": "26e921ecac94b7977cb97c92195a2811",
                "sha256": "14c3478b546e37931d497209e67d35033acb49bac387b0688148c61d4ee40947"
            },
            "downloads": -1,
            "filename": "django_staticinline-1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "26e921ecac94b7977cb97c92195a2811",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 9733,
            "upload_time": "2024-11-19T08:36:21",
            "upload_time_iso_8601": "2024-11-19T08:36:21.314170Z",
            "url": "https://files.pythonhosted.org/packages/f7/1e/c1180e76aa5fd14a34a6cbe076718698e9269d213adc0de189a847f7ed9a/django_staticinline-1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-19 08:36:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bartTC",
    "github_project": "django-staticinline",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-staticinline"
}
        
Elapsed time: 1.19611s