django-compressor-js
Instead of running an extra node.js process watching for changes in your Javascript, this precompiler for django-compressor will convert any ES6 code into ES5 automagically.
Install
pip install django-compressor-js- Add precompiler (
text/es6can be anything, but it has to match the script type in the template)
COMPRESS_PRECOMPILERS = (
("text/es6", "django_compressor_js.precompilers.BabelCompiler"),
)
- Add to HTML template
{% compress js %}
<script src="{% static 'js/test-es6-code.js' %}" type="text/es6"></script>
{% endcompress %}
Caveats
Most ES6 syntax seems to work pretty well, but requiring modules doesn't import correctly. Also, this approach adds some latency when compressing on the fly (i.e. COMPRESS_OFFLINE = False).
Run tests
poetry run pytest
Credits
dukpy and django-compressor for doing all the hard things.
Metadata
Release files for django-compressor-js 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-compressor-js-0.1.0.tar.gz | 2.1 kB | Without provenance | Details for django-compressor-js-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_compressor_js-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for django_compressor_js-0.1.0-py3-none-any.whl |
Total release size: 4.6 kB
Release files / django-compressor-js-0.1.0.tar.gz
| Download URL | django-compressor-js-0.1.0.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28f7d216e7c71a46d558fff4e89dd0808316844efad18fd5c158306841de3812
|
|
BLAKE2b-256 checksum How to use checksums |
43712ad3160839644cfe8cb7c71faaeaf4ad2a4d3064bd84c2a887c8806982f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.3 CPython/2.7.16 Darwin/18.7.0
|
Release files / django_compressor_js-0.1.0-py3-none-any.whl
| Download URL | django_compressor_js-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dcbc1747c9e318ffe04c2da452db1ad65c1626427c782e620081a94fbea1dadc
|
|
BLAKE2b-256 checksum How to use checksums |
df89ed508743afe91fd777b1cfb8a162292d66a1933264fbe45c7161f2275646
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.3 CPython/2.7.16 Darwin/18.7.0
|
Security for django-compressor-js 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.