Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
django_node_assets
.gitignore
LICENSE.txt
README.rst
setup.py

README.rst

Django-node-assets

The Django application that allows install and serve assets via Node.js package manager infrastructure.

Installation

$ pip install django-node-assets

Configuration

Add 'django_node_assets' to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'django_node_assets',
]

Add NodeModulesFinder to STATICFILES_FINDERS:

STATICFILES_FINDERS = [
    ...
    'django_node_assets.finders.NodeModulesFinder',
]

Specify absolute path to the package.json file:

NODE_PACKAGE_JSON = '/var/assets/package.json'

Note

A package.json must have the "dependencies" section and look like:

{
    "dependencies": {
        "jquery": "^3.2.1",
        "jquery-migrate": "^3.0.0",
    }
}

Details here: https://docs.npmjs.com/files/package.json#dependencies

Specify the absolute path to a directory where the nmpinstall management command will install assets:

NODE_MODULES_ROOT = '/var/assets/node_modules'

Note

A base dir must be called node_modules.

Specify path to the nmp executable (optional)

NODE_PACKAGE_MANAGER_EXECUTABLE = '/usr/local/bin/npm'

Note

The Node.js package manager must be already installed in your system.

Usage

Call the nmpinstall management command to install assets specified in the package.json

$ python manage.py npminstall
You can’t perform that action at this time.