Skip to main content

okonomi

Incredibly simple static javascript file handling.

from any template, as many times as you want:

{% jsrequire /path/to/my/js.js %}

or:

{% jsrequire http://google.com/some/api %}

okonomi will take care of getting just the right <script> includes into the HEAD of your template using the hideous ${JS} sigil that you must include in a base template somewhere.

django settings

  • OKONOMI_STATIC_URL set this to whatever makes sense for your django project.

  • OKONOMI_STATIC_PATH set this to whatever makes sense for your django project.

  • OKONOMI_HTML_PATH_TEMPLATE defaults to <script type="text/javascript" src="%s"></script>\n

  • OKONOMI_HTML_URL_TEMPLATE defaults to <script type="text/javascript" src="%s"></script>\n

Requirements

Locally hosted media

  • ${JS} sigil in HEAD or somewhere:

    {% jsrequire /formchecking.js %}
  • add /formchecking.js to set() in context

… (repeat in various templates) …

  • middleware:
    • generate key from what is in the set()

    • not cached?
      • read all the js files, concat, cache

    • insert <script src="/js/cache_key"></script> for ${JS}

Remote hosted media

  • ${JS} sigil in HEAD or somewhere:

    {% jsrequire https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.js %}
  • add url to set() in context

… (repeat in various templates) …

  • middleware:
    • insert <script src="url"></script> for each remote include

author

Nathaniel Smith <nate.smith@coxinc.com> for Cox Media Group Digital & Strategy

license

okonomi is licensed under the MIT license.

Release files for okonomi 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for okonomi 0.1.1
File Size Uploaded
okonomi-0.1.1.tar.gz 7.9 kB Details

Release files / okonomi-0.1.1.tar.gz

Download URL okonomi-0.1.1.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
07a8d6abaa7c3c2845fde8829aeaa0a778c6a5da9a224820d2f7ab63d9410918
BLAKE2b-256 checksum
How to use checksums
f394e08096bc714c506e1cb695e38100a5adad4643971830bbffa3d91bf28c99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page