Skip to main content

Django-yarnpkg

Easy way to use yarnpkg with your Django project.

This is a fork of django-bower <https://github.com/nvbn/django-bower> by Vladimir Iakovlev.

Read full documentation on read-the-docs.

Installation

Install django-yarnpkg package:

pip install django-yarnpkg

Add django-bower to INSTALLED_APPS in your settings:

'django_yarnpkg',

Add staticfinder to STATICFILES_FINDERS:

'django_yarnpkg.finders.NodeModulesFinder',

Specify path to components root (you need to use an absolute path):

NODE_MODULES_ROOT = os.path.join(BASE_DIR, 'node_modules')

If you need, you can manually set the path to yarnpkg:

YARN_PATH = '/usr/bin/yarnpkg'

You can see an example settings file in example project.

Usage

Specify YARN_INSTALLED_APPS in settings, like:

YARN_INSTALLED_APPS = (
    'bootstrap@^4.4.1',
    'underscore@^1.6.1',
)

Download yarn packages with the management command:

./manage.py yarn install

Add scripts in the template, like:

{% load static %}
<script type="text/javascript" src='{% static 'jquery/dist/jquery.js' %}'></script>

In production you need to call yarnpkg install before collectstatic:

./manage.py yarn install
./manage.py collectstatic

If you need to pass arguments to yarnpkg, like –flat, use:

./manage.py yarn install -- --flat

You can call yarnpkg commands like info and update with:

./manage.py yarn info backbone
./manage.py yarn update

Python 3 support

django-yarnpkg supports python 3.3+

Metadata

Release files for django-yarnpkg 6.1.3

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

Source distribution (sdist)

Source distribution for django-yarnpkg 6.1.3
File Size Uploaded Provenance Actions
django_yarnpkg-6.1.3.tar.gz 12.6 kB Without provenance Details for django_yarnpkg-6.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-yarnpkg 6.1.3
File Interpreter ABI Platform Actions
django_yarnpkg-6.1.3-py3-none-any.whl Python 3 none any Details for django_yarnpkg-6.1.3-py3-none-any.whl

Total release size: 28.9 kB

Release files / django_yarnpkg-6.1.3.tar.gz

Download URL django_yarnpkg-6.1.3.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
25a4946e79e4bf4c4ba1841922b0dcb67275c7ec84c15699c4b264ed64f844a9
BLAKE2b-256 checksum
How to use checksums
49a356c2d1549291f70cbd4635cf817045b47f5e8969be6bc80b25ba20e9d44d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / django_yarnpkg-6.1.3-py3-none-any.whl

Download URL django_yarnpkg-6.1.3-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
708a89ce054e96238f4d618fd59014d0ea484102962da71fc947ebc7a164ec91
BLAKE2b-256 checksum
How to use checksums
cff57abc8282cbcb888a89f4e3f65cc260ac8b5aab9476f1d05a93fe2bbd8586
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for django-yarnpkg 6.1.3

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.

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