Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jazzband/django-pipeline
Pipeline is an asset packaging library for Django.
https://github.com/jazzband/django-pipeline
Last synced: 5 days ago
JSON representation
Pipeline is an asset packaging library for Django.
- Host: GitHub
- URL: https://github.com/jazzband/django-pipeline
- Owner: jazzband
- License: mit
- Created: 2011-06-03T19:01:34.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2024-05-11T12:25:18.000Z (6 months ago)
- Last Synced: 2024-05-22T08:09:09.133Z (6 months ago)
- Language: Python
- Homepage: https://django-pipeline.readthedocs.io/
- Size: 1.26 MB
- Stars: 1,493
- Watchers: 27
- Forks: 372
- Open Issues: 145
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Authors: AUTHORS
Awesome Lists containing this project
- awesome-django-cn - django-pipeline, star:1141 - Django 的资源文件管理包。 (资源管理)
- awesome-django - django-pipeline - Asset packaging for Django. (Asset Management)
- awesome-django - django-pipeline - Asset packaging for Django. (Asset Management)
- starred-awesome - django-pipeline - Pipeline is an asset packaging library for Django. (Python)
- best-of-web-python - GitHub - 30% open · ⏱️ 11.05.2024): (Django Utilities)
README
Pipeline
========.. image:: https://jazzband.co/static/img/badge.svg
:alt: Jazzband
:target: https://jazzband.co/.. image:: https://github.com/jazzband/django-pipeline/workflows/Test/badge.svg
:target: https://github.com/jazzband/django-pipeline/actions
:alt: GitHub Actions.. image:: https://codecov.io/gh/jazzband/django-pipeline/branch/master/graph/badge.svg
:target: https://codecov.io/gh/jazzband/django-pipeline
:alt: Coverage.. image:: https://readthedocs.org/projects/django-pipeline/badge/?version=latest
:alt: Documentation Status
:target: https://django-pipeline.readthedocs.io/en/latest/?badge=latestPipeline is an asset packaging library for Django, providing both CSS and
JavaScript concatenation and compression, built-in JavaScript template support,
and optional data-URI image and font embedding... image:: https://github.com/jazzband/django-pipeline/raw/master/img/django-pipeline.svg
:alt: Django Pipeline OverviewInstallation
------------To install it, simply:
.. code-block:: bash
pip install django-pipeline
Quickstart
----------Pipeline compiles and compress your assets files from
``STATICFILES_DIRS`` to your ``STATIC_ROOT`` when you run Django's
``collectstatic`` command.These simple steps add Pipeline to your project to compile multiple ``.js`` and
``.css`` file into one and compress them.Add Pipeline to your installed apps:
.. code-block:: python
# settings.py
INSTALLED_APPS = [
...
'pipeline',
]Use Pipeline specified classes for ``STATICFILES_FINDERS`` and ``STATICFILES_STORAGE``:
.. code-block:: python
STATICFILES_STORAGE = 'pipeline.storage.PipelineManifestStorage'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'pipeline.finders.PipelineFinder',
)Configure Pipeline:
.. code-block:: python
# The folowing config merges CSS files(main.css, normalize.css)
# and JavaScript files(app.js, script.js) and compress them using
# `yuglify` into `css/styles.css` and `js/main.js`
# NOTE: Pipeline only works when DEBUG is False
PIPELINE = {
'STYLESHEETS': {
'css_files': {
'source_filenames': (
'css/main.css',
'css/normalize.css',
),
'output_filename': 'css/styles.css',
'extra_context': {
'media': 'screen,projection',
},
},
},
'JAVASCRIPT': {
'js_files': {
'source_filenames': (
'js/app.js',
'js/script.js',
),
'output_filename': 'js/main.js',
}
}
}Then, you have to install compilers and compressors binary manually.
For example, you can install them using `NPM `_
and address them from ``node_modules`` directory in your project path:.. code-block:: python
PIPELINE.update({
'YUGLIFY_BINARY': path.join(BASE_DIR, 'node_modules/.bin/yuglify'),
})
# For a list of all supported compilers and compressors see documentationLoad static files in your template:
.. code-block::
{% load pipeline %}
{% stylesheet 'css_files' %}
{% javascript 'js_files' %}Documentation
-------------For documentation, usage, and examples, see:
https://django-pipeline.readthedocs.ioIssues
------
You can report bugs and discuss features on the `issues page `_.Changelog
---------See `HISTORY.rst `_.