django-yarnpkg


Namedjango-yarnpkg JSON
Version 6.1.2 PyPI version JSON
download
home_pagehttps://edugit.org/AlekSIS/libs/django-yarnpkg
SummaryIntegrate django with yarnpkg
upload_time2024-01-10 14:53:27
maintainer
docs_urlNone
authorDominik George
requires_python
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Django-yarnpkg
==============

Easy way to use `yarnpkg <https://yarnpkg.com/>`_ with your `Django <https://www.djangoproject.com/>`_ project.

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

Read full documentation on `read-the-docs <https://django-yarnpkg.readthedocs.io/en/latest/>`_.

Installation
------------

Install django-yarnpkg package:

.. code-block:: bash

    pip install django-yarnpkg

Add django-bower to `INSTALLED_APPS` in your settings:

.. code-block:: python

    'django_yarnpkg',

Add staticfinder to `STATICFILES_FINDERS`:

.. code-block:: python

    'django_yarnpkg.finders.NodeModulesFinder',

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

.. code-block:: python

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


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

.. code-block:: python

    YARN_PATH = '/usr/bin/yarnpkg'

You can see an example settings file in `example project <https://edugit.org/AlekSIS/libs/django-yarnpkg/blob/master/example/example/settings.py>`_.

Usage
-----

Specify `YARN_INSTALLED_APPS` in settings, like:

.. code-block:: python

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

Download yarn packages with the management command:

.. code-block:: bash

    ./manage.py yarn install

Add scripts in the template, like:

.. code-block:: html+django

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

In production you need to call `yarnpkg install` before `collectstatic`:

.. code-block:: bash

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

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

.. code-block:: bash

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

You can call yarnpkg commands like `info` and `update` with:

.. code-block:: bash

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

Python 3 support
----------------
django-yarnpkg supports python 3.3+

            

Raw data

            {
    "_id": null,
    "home_page": "https://edugit.org/AlekSIS/libs/django-yarnpkg",
    "name": "django-yarnpkg",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Dominik George",
    "author_email": "nik@naturalnet.de",
    "download_url": "https://files.pythonhosted.org/packages/8c/7c/c4768cfcf8af8fab73dd1dc23e0dc2f50453196f673e887e2b228bf5957c/django-yarnpkg-6.1.2.tar.gz",
    "platform": null,
    "description": "Django-yarnpkg\n==============\n\nEasy way to use `yarnpkg <https://yarnpkg.com/>`_ with your `Django <https://www.djangoproject.com/>`_ project.\n\nThis is a fork of `django-bower <https://github.com/nvbn/django-bower>` by Vladimir Iakovlev.\n\nRead full documentation on `read-the-docs <https://django-yarnpkg.readthedocs.io/en/latest/>`_.\n\nInstallation\n------------\n\nInstall django-yarnpkg package:\n\n.. code-block:: bash\n\n    pip install django-yarnpkg\n\nAdd django-bower to `INSTALLED_APPS` in your settings:\n\n.. code-block:: python\n\n    'django_yarnpkg',\n\nAdd staticfinder to `STATICFILES_FINDERS`:\n\n.. code-block:: python\n\n    'django_yarnpkg.finders.NodeModulesFinder',\n\nSpecify path to components root (you need to use an absolute path):\n\n.. code-block:: python\n\n    NODE_MODULES_ROOT = os.path.join(BASE_DIR, 'node_modules')\n\n\nIf you need, you can manually set the path to yarnpkg:\n\n.. code-block:: python\n\n    YARN_PATH = '/usr/bin/yarnpkg'\n\nYou can see an example settings file in `example project <https://edugit.org/AlekSIS/libs/django-yarnpkg/blob/master/example/example/settings.py>`_.\n\nUsage\n-----\n\nSpecify `YARN_INSTALLED_APPS` in settings, like:\n\n.. code-block:: python\n\n    YARN_INSTALLED_APPS = (\n        'bootstrap@^4.4.1',\n        'underscore@^1.6.1',\n    )\n\nDownload yarn packages with the management command:\n\n.. code-block:: bash\n\n    ./manage.py yarn install\n\nAdd scripts in the template, like:\n\n.. code-block:: html+django\n\n    {% load static %}\n    <script type=\"text/javascript\" src='{% static 'jquery/dist/jquery.js' %}'></script>\n\nIn production you need to call `yarnpkg install` before `collectstatic`:\n\n.. code-block:: bash\n\n    ./manage.py yarn install\n    ./manage.py collectstatic\n\nIf you need to pass arguments to yarnpkg, like `--flat`, use:\n\n.. code-block:: bash\n\n    ./manage.py yarn install -- --flat\n\nYou can call yarnpkg commands like `info` and `update` with:\n\n.. code-block:: bash\n\n    ./manage.py yarn info backbone\n    ./manage.py yarn update\n\nPython 3 support\n----------------\ndjango-yarnpkg supports python 3.3+\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Integrate django with yarnpkg",
    "version": "6.1.2",
    "project_urls": {
        "Homepage": "https://edugit.org/AlekSIS/libs/django-yarnpkg"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "85e6763a073a329289cabca006640ca43e9f25b008a5338ccc1d9e43ea105494",
                "md5": "161dc4410586a86797c9d97dc255f3a9",
                "sha256": "2d70ccf1688390f3e5df4bee29e8effd73677d24778285d2f747bc9f4eb94d5b"
            },
            "downloads": -1,
            "filename": "django_yarnpkg-6.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "161dc4410586a86797c9d97dc255f3a9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 16313,
            "upload_time": "2024-01-10T14:53:25",
            "upload_time_iso_8601": "2024-01-10T14:53:25.382105Z",
            "url": "https://files.pythonhosted.org/packages/85/e6/763a073a329289cabca006640ca43e9f25b008a5338ccc1d9e43ea105494/django_yarnpkg-6.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8c7cc4768cfcf8af8fab73dd1dc23e0dc2f50453196f673e887e2b228bf5957c",
                "md5": "b8b99762afa496322f15c46b52ae1c36",
                "sha256": "3148a73d969019f743a1aac0708cc3dbca1432b963944ee7c6ff248513ac4c17"
            },
            "downloads": -1,
            "filename": "django-yarnpkg-6.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "b8b99762afa496322f15c46b52ae1c36",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 12611,
            "upload_time": "2024-01-10T14:53:27",
            "upload_time_iso_8601": "2024-01-10T14:53:27.519135Z",
            "url": "https://files.pythonhosted.org/packages/8c/7c/c4768cfcf8af8fab73dd1dc23e0dc2f50453196f673e887e2b228bf5957c/django-yarnpkg-6.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-10 14:53:27",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "django-yarnpkg"
}
        
Elapsed time: 0.23791s