././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757763098.9519331 django_pipeline-4.1.0/0000755000175100017510000000000015061253033014307 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/.flake80000644000175100017510000000011415061253017015460 0ustar00runnerrunner[flake8] max-line-length = 88 exclude = .tox node_modules *env/ ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.927933 django_pipeline-4.1.0/.github/0000755000175100017510000000000015061253033015647 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/.github/dependabot.yml0000644000175100017510000000016715061253017020505 0ustar00runnerrunnerversion: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "monthly" ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.928933 django_pipeline-4.1.0/.github/workflows/0000755000175100017510000000000015061253033017704 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/.github/workflows/release.yml0000644000175100017510000000173315061253017022055 0ustar00runnerrunnername: Release on: push: tags: - '*' jobs: build: if: github.repository == 'jazzband/django-pipeline' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.9' - name: Install dependencies run: | python -m pip install -U pip python -m pip install -U twine build setuptools-scm - name: Build package run: | python -m setuptools_scm python -m build twine check --strict dist/* - name: Upload packages to Jazzband if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@release/v1 with: user: jazzband password: ${{ secrets.JAZZBAND_RELEASE_KEY }} repository_url: https://jazzband.co/projects/django-pipeline/upload ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/.github/workflows/test.yml0000644000175100017510000000561715061253017021421 0ustar00runnerrunnername: Test on: [push, pull_request] jobs: build: name: build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.10'] django-version: ['4.1', '4.2', '5.0', '5.1', '5.2', 'main'] exclude: - python-version: '3.9' django-version: '5.0' - python-version: '3.9' django-version: '5.1' - python-version: '3.9' django-version: '5.2' - python-version: '3.9' django-version: 'main' - python-version: 'pypy-3.10' django-version: '4.1' - python-version: 'pypy-3.10' django-version: '4.2' - python-version: 'pypy-3.10' django-version: '5.0' - python-version: 'pypy-3.10' django-version: '5.1' - python-version: 'pypy-3.10' django-version: '5.2' - python-version: 'pypy-3.10' django-version: 'main' - python-version: '3.12' django-version: '4.1' - python-version: '3.13' django-version: '4.1' - python-version: '3.13' django-version: '4.2' - python-version: '3.13' django-version: '5.0' - python-version: '3.13' django-version: '5.1' steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Set up Node uses: actions/setup-node@v4 with: node-version: '16' - name: Install Node dependencies run: npm install - name: Get pip cache dir id: pip-cache run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT - name: Cache uses: actions/cache@v4 with: path: ${{ steps.pip-cache.outputs.dir }} key: ${{ matrix.python-version }}-v1-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('**/tox.ini') }} restore-keys: | ${{ matrix.python-version }}-v1- - name: Install Python dependencies run: | python -m pip install --upgrade pip python -m pip install --upgrade tox tox-gh-actions - name: Tox tests run: | tox -v env: DJANGO: ${{ matrix.django-version }} - name: Upload coverage uses: codecov/codecov-action@v5 with: name: Python ${{ matrix.python-version }} ruff: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: pip install --user ruff==0.12.5 - run: ruff check . --extend-select=C4,C9,I,PLC,PLE,PLR,U --ignore=C414,I001,PLR0913,UP007,UP032 --target-version=py39 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/.gitignore0000644000175100017510000000054215061253017016302 0ustar00runnerrunner.AppleDouble *.pyc :2e_* *.tmproj .*.swp *.swo build dist MANIFEST docs/_build/ *.egg-info .coverage coverage/ coverage.xml tests/static/ tests/assets/js/dummy.js tests/node_modules/ .tox/ .DS_Store .idea .venv .vscode .project .pydevproject .ropeproject __pycache__ npm-debug.log tests/npm-cache django-pipeline-*/ .tags node_modules/ package-lock.json ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/.pre-commit-config.yaml0000644000175100017510000000067515061253017020602 0ustar00runnerrunnerrepos: - repo: https://github.com/psf/black rev: 24.8.0 hooks: - id: black - repo: https://github.com/PyCQA/isort rev: 5.13.2 hooks: - id: isort - repo: https://github.com/PyCQA/flake8 rev: 7.1.1 hooks: - id: flake8 - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: check-merge-conflict - id: check-yaml ci: autoupdate_schedule: quarterly ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/.readthedocs.yaml0000644000175100017510000000035515061253017017543 0ustar00runnerrunner# .readthedocs.yaml # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details version: 2 build: os: ubuntu-22.04 tools: python: "3.10" sphinx: configuration: docs/conf.py ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/AUTHORS0000644000175100017510000001171615061253017015367 0ustar00runnerrunnerPipeline is a fork of django-compress which was originally created by Andreas Pelme in 2008. These people have provided bug fixes, new features, improved the documentation or just made Pipeline more awesome. * Adam Charnock * Alan Lu * Aleksey Porfirov * Alex Gavrișco * Alexander Artemenko * Alexander Pugachev * Alexis Svinartchouk * Allard Stijnman * Alvin Mites * Andreas Cederström * Andrew Choi * Andy Kish * Ara Anjargolian * Arnar Yngvason * Austin Pua * Axel Haustant * Balazs Kossovics * Ben Spaulding * Ben Vinegar * Brad Pitcher * Brant Young * Brawaga * Brian Montgomery * Bryan Chow * Buky * Caio Ariede * Camilo Nova * Carl Meyer * Casey Greene * Chad Miller * Chris Applegate * Chris Reeves * Christian Hammond * Christofer Bertonha * Christopher Dilorenzo * Collin Stedman * Corey Farwell * Corrado Primier * Danielle Madeley * David Charbonnier * David Cramer * David Hughes * David Trowbridge * Denis V Seleznyov * DJ Sharkey * Edwin Lunando * Eric Hamiter * Evan Myller * Fabian Büchler * Feanil Patel * Felix Last * Florent Messa * Frankie Dintino * Hannes Ljungberg * Idan Zalzberg * Jacob Haslehurst * James Keys * Jannis Leidel * Jared Scott * Jaromir Fojtu * Jeff Held * John Whitlock (@jwhitlock) * Jon Dufresne * Josh Braegger * Joshua Kehn * Julien Hartmann * Kevin Fox (@KFoxder) * Kristian Glass * Kyle MacFarlane * Leonardo Orozco * Luke Yu-Po Chen * Mark Sandstrom * Matt Dennewitz * Matthieu Gallet * Max Klymyshyn * Melvin Laplanche * Michael Weibel * Michał Górny * Miguel Araujo Perez * Mike Gilbert * Miroslav Shubernetskiy * Natal Ngetal * Nathan Cox * Nathan Shafer * Patrick Altman * Peter Baumgartner * Peyman Salehi * Philipp Wollermann * Pierre Drescher * Rajiv Bose * Rami Chowdhury * Remco Wendt * Remy Sanchez * Sam Thomson * Sander Smits * Sander Steffann * Sassan Haradji (@sassanh) * Sayed Raianul Kabir * Simon Lydell * Sirex * Sławek Ehlert * Stefano Brentegani * Stephan Wienczny * Steven Cummings * Tadas Dailyda * Teo Klestrup Röijezon * Thomas Parslow * Tiago Espinha * Timothée Peignier * Tom Yam * Tomek Paczkowski * Trey Smith * Vadym S. Khondar (@vskh) * Venelin Stoykov * Victor Shnayder * Wictor Olseryd * Wismill * Zachary Kazanski * Zenobius Jiricek * Zeus Kronion ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/CODE_OF_CONDUCT.md0000644000175100017510000000450715061253017017116 0ustar00runnerrunner# Code of Conduct As contributors and maintainers of the Jazzband projects, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. We are committed to making participation in the Jazzband a harassment-free experience for everyone, regardless of the level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. Examples of unacceptable behavior by participants include: - The use of sexualized language or imagery - Personal attacks - Trolling or insulting/derogatory comments - Public or private harassment - Publishing other's private information, such as physical or electronic addresses, without explicit permission - Other unethical or unprofessional conduct The Jazzband roadies have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. By adopting this Code of Conduct, the roadies commit themselves to fairly and consistently applying these principles to every aspect of managing the jazzband projects. Roadies who do not follow or enforce the Code of Conduct may be permanently removed from the Jazzband roadies. This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the roadies at `roadies@jazzband.co`. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Roadies are obligated to maintain confidentiality with regard to the reporter of an incident. This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.3.0, available at [https://contributor-covenant.org/version/1/3/0/][version] [homepage]: https://contributor-covenant.org [version]: https://contributor-covenant.org/version/1/3/0/ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/CONTRIBUTING.rst0000644000175100017510000000322015061253017016747 0ustar00runnerrunner.. image:: https://jazzband.co/static/img/jazzband.svg :target: https://jazzband.co/ :alt: Jazzband This is a `Jazzband `_ project. By contributing you agree to abide by the `Contributor Code of Conduct `_ and follow the `guidelines `_. Contribute ========== #. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. There is a **contribute!** tag for issues that should be ideal for people who are not very familiar with the codebase yet. #. Fork the repository on Github to start making your changes on a topic branch. #. Write a test which shows that the bug was fixed or that the feature works as expected. #. Send a pull request and bug the maintainer until it gets merged and published. Make sure to add yourself to *AUTHORS*. Otherwise, if you simply wants to suggest a feature or report a bug, create an issue : https://github.com/jazzband/django-pipeline/issues Running tests ============= We use tox to run the test suite on different versions locally (and GitHub Actions to automate the check for PRs). To tun the test suite locally, please make sure your python environment has tox and django installed:: python3.7 -m pip install tox Since we use a number of node.js tools, one should first install the node dependencies. We recommend using [nvm](https://github.com/nvm-sh/nvm#installation-and-update) , tl;dr:: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash nvm install node nvm use node And then simply execute tox to run the whole test matrix:: tox ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/HISTORY.rst0000644000175100017510000001733715061253017016217 0ustar00runnerrunner.. :changelog: History ======= 4.1.0 ===== * Add support for Python 3.13 * Add support for Django 5.2 4.0.0 ===== * Drop support for Python 3.8 * Confirm support for Django 5.1 and drop support for Django 3.2 * Use pyproject.toml 3.1.0 ===== * Replace deprecated .warn method with .warning * Update sourcemap paths when concatenating source files * Ensure correct compiler error styling and strip ANSI escape sequences 3.0.0 ===== * Use Pypy 3.10 * Drop support for Python 3.7 * Drop support for Django 2 * Add Python 3.12 support * Add Django 4.2 support * Add Django 5.0 support 2.1.0 ===== * Update README.rst and add Pipeline overview image. * Add TypeScript compiler support. * Drop support for ``manifesto`` package. * Add support for Python 3.11 and Django 4.1 2.0.9 ===== * Fixed some typos in the docs. * Fixed string type of errors reported from compilers and compressors. * Updated github actions matrix for host and django support. * Updated github actions configuration to use modern versions of third-party actions. * Improved the packager to copy files to (S3) storage if it does not exist (#502). 2.0.8 ===== * Added **Django 4.0** compatibility. Thanks to @kevinmarsh (#760) * Add tests for **Django 4.0**, **Python 3.9** and **Python 3.10**. Thank to @kevinmarsh (#739) * Introduce CODE_OF_CONDUCT.md for the project. Thank to @hugovk (#758) * Add precision in the documentation for PipelineCachedStorage. Thank to @gatsinski (#739) * Drop support for slimit compressor (#765) due to package not released an official version for Python 3 and not any new package release from 2013. * Edit github actions matrix: django 3.2.9 support python 3.10, remove python 4.0 (doesn't exist) and exclude pypy-3.8 for django-main. * Add .pre-commit-config.yaml. Thanks to @hugovk (#762) * Update package.json due to CoffeeScript on NPM has moved to "coffeescript" * Update setup.py with Django 4.0 and Python 3.10 2.0.7 ===== * Added **Django 3.2** compatibility (Thanks to @jramnai in #751) 2.0.6 ====== * Added terser (JS compressor for ES5 and ES6) (Thanks to @felix-last in #696) * Moved tests to GitHub Actions: https://github.com/jazzband/django-pipeline/actions (#738) * Fixed deprecation warnings from Django (Thanks to @edelvalle in #731) 2.0.5 ====== * Adding **Django 3.1** compatibility. * CachedStaticFilesStorage is removed from Django. Add a check of the current version to prevent error while importing. Thank to @vmsp * Context in django.template.base is removed from Django and not used anymore in django-pipeline. * Fixing widgets tests of django-pipeline due to Media.render_js change in Django. More information in Django ticket #31892 2.0.4 ====== * Adding **css-html-js-minify** support to compress JS and CSS. * Update compressors documentation with css-html-js-minify. * Create tests for css-html-js-minify compressor. * Optimization by grouping the tests yuglify compressor. 2.0.3 ====== * Remove futures from pipeline **setup.py** requirements. 2.0.2 ===== * Fix Middleware to properly decode HTML. Thank to @gatsinski * Keep mimetypes as str. Thank to @benspaulding * Based on #642 add 'NonPackagingPipelineManifestStorage' and update the documentation: **storages.rst**. Thank to @kronion 2.0.1 ===== * Add subclass of ManifestStaticFilesStorage. Thank to @jhpinson * Change the documentation to use PipelineManifestStorage in configuration instead of PipelineCachedStorage now deprecated. * Change import MutableMapping from collections.abc. Thank to @colons 2.0.0 ===== * **Definitely drop the support of Python 2**. * Drop support for Python 3.5 (not compatible with PEP 498). * Remove 'decorator.py' how was used for backward compatibility between python 2 and 3 for metaclass inheritance on PipelineFormMedia. * Replace 'format' by 'fstring' (PEP 498: Literal String Interpolation). * Remove of old imports form 'django.utils.six' and these fixes (1.7.0). * Remove tests of uncovered versions of Python and Django. * Replace tests for Pypy by Pypy3. * Explicitly specify when files are read / write in binary mode. * Set opening files for tests to deal with universal newlines. * Upgrade documentation version to 2.0 to follow the project version. 1.7.0 ===== * Release the last major version of django-pipeline working on Python 2. * Thank you for all the modifications made since version 1.6.14, which we cannot quote. * Apply an optimization to save time during development. Thank to @blankser * Edit setup.py to follow the recommendation of the documentation. Thank to @shaneikennedy * Add tests for Django 3.0 and Python 3.8 * Add alternatives imports for django.utils.six, who has been removed in Django 3.0 1.6.14 ====== * Fix packaging issues. 1.6.13 ====== * Fix forward-slashed paths on Windows. Thanks to @etiago * Fix CSS URL detector to match quotes correctly. Thanks to @vskh * Add a compiler_options dict to compile, to allow passing options to custom compilers. Thanks to @sassanh * Verify support for Django 1.11. Thanks to @jwhitlock 1.6.12 ====== * Supports Django 1.11 * Fix a bug with os.rename on windows. Thanks to @wismill * Fix to view compile error if happens. Thanks to @brawaga * Add support for Pipeline CSS/JS packages in forms and widgets. Thanks to @chipx86 1.6.11 ====== * Fix performance regression. Thanks to Christian Hammond. 1.6.10 ====== * Added Django 1.10 compatiblity issues. Thanks to Austin Pua and Silvan Spross. * Documentation improvements. Thanks to Chris Streeter. 1.6.9 ===== * Various build improvements. * Improved setup.py classifiers. Thanks to Sobolev Nikita. * Documentation improvements. Thanks to Adam Chainz. 1.6.8 ===== * Made templatetags easier to subclass for special rendering behavior. Thanks to Christian Hammond. * Updated the link to readthedocs. Thanks to Corey Farwell. * Fixed some log messages to correctly refer to the new PIPELINE settings tructure. Thanks to Alvin Mites. * Changed file outdated checks to use os.path methods directly, avoiding potential SuspiciousFileOperation errors which could appear with some django storage configurations. 1.6.7 ===== * Add a view for collecting static files before serving them. This behaves like django's built-in ``static`` view and allows running the collector for images, fonts, and other static files that do not need to be compiled. Thanks to Christian Hammond. * Update documentation for the ES6Compiler to clarify filename requirements. Thanks to Nathan Cox. * Add error output for compiler errors within the browser. This provides for a much better experience when compiling files from the devserver. Thanks to Christian Hammond. * Make unit tests run against Django 1.6 and 1.7. Thanks to Sławek Ehlert. 1.6.6 ===== * Fix filtering-out of files which require a finder to locate. * Allow compilers to override the output path. * Fix error reporting when a compiler fails to execute. * Fix IOErrors when running collectstatic with some nodejs-based compilers and compressors. Thanks to Frankie Dintino. * Fix compatibility of unit tests when running on Windows. Thanks to Frankie Dintino. * Add unit tests for compilers and compressors. Thanks to Frankie Dintino. 1.6.5 ===== * Fix Django < 1.8 compatibility. Thanks to David Trowbridge. * Allow to disable collector during development. Thanks to Leonardo Orozco. 1.6.4 ===== * Fix compressor subprocess calls. 1.6.3 ===== * Fix compressor command flattening. 1.6.2 ===== * Remove subprocess32 usage since it breaks universal support. 1.6.1 ===== * Fix path quoting issues. Thanks to Chad Miller. * Use subprocess32 package when possible. * Documentation fixes. Thanks to Sławek Ehlert and Jannis Leidel. 1.6.0 ===== * Add full support for Django 1.9. * Drop support for Django 1.7. * Drop support for Python 2.6. * **BACKWARD INCOMPATIBLE** : Change configuration settings. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/LICENSE0000644000175100017510000000220015061253017015310 0ustar00runnerrunnerCopyright (©) 2008 Andreas Pelme Copyright (©) 2011-2018 Timothée Peignier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/MANIFEST.in0000644000175100017510000000071015061253017016045 0ustar00runnerrunnerrecursive-include pipeline/templates *.html *.jinja recursive-include pipeline/jinja2 *.html *.jinja include AUTHORS LICENSE README.rst HISTORY.rst CONTRIBUTING.rst recursive-include tests * recursive-exclude tests *.pyc *.pyo recursive-exclude tests/node_modules * recursive-exclude tests/npm-cache * recursive-exclude tests/npm * include docs/Makefile docs/make.bat docs/conf.py recursive-include docs *.rst exclude package.json requirements.txt tox.ini ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757763098.9509332 django_pipeline-4.1.0/PKG-INFO0000644000175100017510000001341215061253033015405 0ustar00runnerrunnerMetadata-Version: 2.4 Name: django-pipeline Version: 4.1.0 Summary: Pipeline is an asset packaging library for Django. Author-email: Timothée Peignier License: MIT Project-URL: homepage, https://github.com/jazzband/django-pipeline/ Project-URL: documentation, https://django-pipeline.readthedocs.io/ Project-URL: repository, https://github.com/jazzband/django-pipeline Project-URL: changelog, https://github.com/jazzband/django-pipeline/blob/master/HISTORY.rst Keywords: django,pipeline,asset,compiling,concatenation,compression,packaging Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Framework :: Django Classifier: Framework :: Django :: 4.0 Classifier: Framework :: Django :: 4.1 Classifier: Framework :: Django :: 4.2 Classifier: Framework :: Django :: 5.0 Classifier: Framework :: Django :: 5.1 Classifier: Framework :: Django :: 5.2 Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Utilities Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content Requires-Python: >=3.9 Description-Content-Type: text/x-rst License-File: LICENSE License-File: AUTHORS Requires-Dist: setuptools Requires-Dist: wheel Provides-Extra: testing Requires-Dist: coveralls; extra == "testing" Requires-Dist: tox; extra == "testing" Requires-Dist: wheel; extra == "testing" Requires-Dist: django; extra == "testing" Dynamic: license-file 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=latest Pipeline 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 Overview Installation ------------ 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 documentation Load 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.io Issues ------ You can report bugs and discuss features on the `issues page `_. Changelog --------- See `HISTORY.rst `_. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/README.rst0000644000175100017510000000730115061253017016001 0ustar00runnerrunnerPipeline ======== .. 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=latest Pipeline 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 Overview Installation ------------ 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 documentation Load 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.io Issues ------ You can report bugs and discuss features on the `issues page `_. Changelog --------- See `HISTORY.rst `_. ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.949933 django_pipeline-4.1.0/django_pipeline.egg-info/0000755000175100017510000000000015061253033021130 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763098.0 django_pipeline-4.1.0/django_pipeline.egg-info/PKG-INFO0000644000175100017510000001341215061253032022225 0ustar00runnerrunnerMetadata-Version: 2.4 Name: django-pipeline Version: 4.1.0 Summary: Pipeline is an asset packaging library for Django. Author-email: Timothée Peignier License: MIT Project-URL: homepage, https://github.com/jazzband/django-pipeline/ Project-URL: documentation, https://django-pipeline.readthedocs.io/ Project-URL: repository, https://github.com/jazzband/django-pipeline Project-URL: changelog, https://github.com/jazzband/django-pipeline/blob/master/HISTORY.rst Keywords: django,pipeline,asset,compiling,concatenation,compression,packaging Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Framework :: Django Classifier: Framework :: Django :: 4.0 Classifier: Framework :: Django :: 4.1 Classifier: Framework :: Django :: 4.2 Classifier: Framework :: Django :: 5.0 Classifier: Framework :: Django :: 5.1 Classifier: Framework :: Django :: 5.2 Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Utilities Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content Requires-Python: >=3.9 Description-Content-Type: text/x-rst License-File: LICENSE License-File: AUTHORS Requires-Dist: setuptools Requires-Dist: wheel Provides-Extra: testing Requires-Dist: coveralls; extra == "testing" Requires-Dist: tox; extra == "testing" Requires-Dist: wheel; extra == "testing" Requires-Dist: django; extra == "testing" Dynamic: license-file 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=latest Pipeline 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 Overview Installation ------------ 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 documentation Load 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.io Issues ------ You can report bugs and discuss features on the `issues page `_. Changelog --------- See `HISTORY.rst `_. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763098.0 django_pipeline-4.1.0/django_pipeline.egg-info/SOURCES.txt0000644000175100017510000001022715061253032023015 0ustar00runnerrunner.flake8 .gitignore .pre-commit-config.yaml .readthedocs.yaml AUTHORS CODE_OF_CONDUCT.md CONTRIBUTING.rst HISTORY.rst LICENSE MANIFEST.in README.rst pyproject.toml .github/dependabot.yml .github/workflows/release.yml .github/workflows/test.yml django_pipeline.egg-info/PKG-INFO django_pipeline.egg-info/SOURCES.txt django_pipeline.egg-info/dependency_links.txt django_pipeline.egg-info/requires.txt django_pipeline.egg-info/top_level.txt docs/Makefile docs/compilers.rst docs/compressors.rst docs/conf.py docs/configuration.rst docs/index.rst docs/installation.rst docs/make.bat docs/signals.rst docs/storages.rst docs/templates.rst docs/usage.rst docs/using.rst img/django-pipeline.svg pipeline/__init__.py pipeline/collector.py pipeline/conf.py pipeline/exceptions.py pipeline/finders.py pipeline/forms.py pipeline/glob.py pipeline/middleware.py pipeline/packager.py pipeline/signals.py pipeline/storage.py pipeline/utils.py pipeline/views.py pipeline/compilers/__init__.py pipeline/compilers/coffee.py pipeline/compilers/es6.py pipeline/compilers/less.py pipeline/compilers/livescript.py pipeline/compilers/sass.py pipeline/compilers/stylus.py pipeline/compilers/typescript.py pipeline/compressors/__init__.py pipeline/compressors/closure.py pipeline/compressors/csshtmljsminify.py pipeline/compressors/cssmin.py pipeline/compressors/csstidy.py pipeline/compressors/jsmin.py pipeline/compressors/terser.py pipeline/compressors/uglifyjs.py pipeline/compressors/yuglify.py pipeline/compressors/yui.py pipeline/jinja2/__init__.py pipeline/jinja2/pipeline/css.jinja pipeline/jinja2/pipeline/inline_js.jinja pipeline/jinja2/pipeline/js.jinja pipeline/templates/pipeline/compile_error.html pipeline/templates/pipeline/css.html pipeline/templates/pipeline/css.jinja pipeline/templates/pipeline/inline_js.html pipeline/templates/pipeline/inline_js.jinja pipeline/templates/pipeline/js.html pipeline/templates/pipeline/js.jinja pipeline/templatetags/__init__.py pipeline/templatetags/pipeline.py tests/__init__.py tests/models.py tests/settings.py tests/urls.py tests/utils.py tests/views.py tests/assets/compilers/coffee/expected.js tests/assets/compilers/coffee/input.coffee tests/assets/compilers/es6/expected.js tests/assets/compilers/es6/input.es6 tests/assets/compilers/less/expected.css tests/assets/compilers/less/input.less tests/assets/compilers/livescript/expected.js tests/assets/compilers/livescript/input.ls tests/assets/compilers/scss/expected.css tests/assets/compilers/scss/input.scss tests/assets/compilers/stylus/expected.css tests/assets/compilers/stylus/input.styl tests/assets/compilers/typescript/expected.js tests/assets/compilers/typescript/input.ts tests/assets/compressors/closure.js tests/assets/compressors/csshtmljsminify.css tests/assets/compressors/csshtmljsminify.js tests/assets/compressors/cssmin.css tests/assets/compressors/csstidy.css tests/assets/compressors/jsmin.js tests/assets/compressors/slimit.js tests/assets/compressors/terser.js tests/assets/compressors/uglifyjs.js tests/assets/compressors/yuglify.css tests/assets/compressors/yuglify.js tests/assets/compressors/yui.css tests/assets/compressors/yui.js tests/assets/css/first.css tests/assets/css/second.css tests/assets/css/sourcemap.css tests/assets/css/unicode.css tests/assets/css/urls.css tests/assets/css/nested/nested.css tests/assets/fonts/pipeline.eot tests/assets/fonts/pipeline.svg tests/assets/fonts/pipeline.ttf tests/assets/fonts/pipeline.woff tests/assets/images/arrow.png tests/assets/images/sprite-buttons.png tests/assets/images/embed/arrow.png tests/assets/js/application.js tests/assets/js/dummy.coffee tests/assets/js/first.js tests/assets/js/second.js tests/assets/js/sourcemap.js tests/assets/templates/photo/detail.jst tests/assets/templates/photo/list.jst tests/assets/templates/video/detail.jst tests/templates/empty.html tests/templates/index.html tests/tests/__init__.py tests/tests/models.py tests/tests/test_collector.py tests/tests/test_compiler.py tests/tests/test_compressor.py tests/tests/test_conf.py tests/tests/test_forms.py tests/tests/test_glob.py tests/tests/test_middleware.py tests/tests/test_packager.py tests/tests/test_storage.py tests/tests/test_template.py tests/tests/test_utils.py tests/tests/test_views.py././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763098.0 django_pipeline-4.1.0/django_pipeline.egg-info/dependency_links.txt0000644000175100017510000000000115061253032025175 0ustar00runnerrunner ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763098.0 django_pipeline-4.1.0/django_pipeline.egg-info/requires.txt0000644000175100017510000000006715061253032023532 0ustar00runnerrunnersetuptools wheel [testing] coveralls tox wheel django ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763098.0 django_pipeline-4.1.0/django_pipeline.egg-info/top_level.txt0000644000175100017510000000003515061253032023657 0ustar00runnerrunnerdist docs img pipeline tests ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.931933 django_pipeline-4.1.0/docs/0000755000175100017510000000000015061253033015237 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/docs/Makefile0000644000175100017510000001102215061253017016675 0ustar00runnerrunner# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django-pipeline.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django-pipeline.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/django-pipeline" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/django-pipeline" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." make -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/docs/compilers.rst0000644000175100017510000001461715061253017020001 0ustar00runnerrunner.. _ref-compilers: ========= Compilers ========= TypeScript compiler ====================== The TypeScript compiler uses `TypeScript `_ to compile your TypeScript code to JavaScript. To use it add this to your ``PIPELINE['COMPILERS']`` :: PIPELINE['COMPILERS'] = ( 'pipeline.compilers.typescript.TypeScriptCompiler', ) ``TYPE_SCRIPT_BINARY`` --------------------------------- Command line to execute for TypeScript program. You will most likely change this to the location of ``tsc`` on your system. Defaults to ``'/usr/bin/env tsc'``. ``TYPE_SCRIPT_ARGUMENTS`` ------------------------------------ Additional arguments to use when ``tsc`` is called. Defaults to ``''``. Coffee Script compiler ====================== The Coffee Script compiler uses `Coffee Script `_ to compile your javascript. To use it add this to your ``PIPELINE['COMPILERS']`` :: PIPELINE['COMPILERS'] = ( 'pipeline.compilers.coffee.CoffeeScriptCompiler', ) ``COFFEE_SCRIPT_BINARY`` --------------------------------- Command line to execute for coffee program. You will most likely change this to the location of coffee on your system. Defaults to ``'/usr/bin/env coffee'``. ``COFFEE_SCRIPT_ARGUMENTS`` ------------------------------------ Additional arguments to use when coffee is called. Defaults to ``''``. Live Script compiler ====================== The LiveScript compiler uses `LiveScript `_ to compile your javascript. To use it add this to your ``PIPELINE['COMPILERS']`` :: PIPELINE['COMPILERS'] = ( 'pipeline.compilers.livescript.LiveScriptCompiler', ) ``LIVE_SCRIPT_BINARY`` --------------------------------- Command line to execute for LiveScript program. You will most likely change this to the location of lsc on your system. Defaults to ``'/usr/bin/env lsc'``. ``LIVE_SCRIPT_ARGUMENTS`` ------------------------------------ Additional arguments to use when lsc is called. Defaults to ``''``. LESS compiler ============= The LESS compiler uses `LESS `_ to compile your stylesheets. To use it add this to your ``PIPELINE['COMPILERS']`` :: PIPELINE['COMPILERS'] = ( 'pipeline.compilers.less.LessCompiler', ) ``LESS_BINARY`` ------------------------ Command line to execute for lessc program. You will most likely change this to the location of lessc on your system. Defaults to ``'/usr/bin/env lessc'``. ``LESS_ARGUMENTS`` --------------------------- Additional arguments to use when lessc is called. Defaults to ``''``. SASS compiler ============= The SASS compiler uses `SASS `_ to compile your stylesheets. To use it add this to your ``PIPELINE['COMPILERS']`` :: PIPELINE['COMPILERS'] = ( 'pipeline.compilers.sass.SASSCompiler', ) ``SASS_BINARY`` ------------------------ Command line to execute for sass program. You will most likely change this to the location of sass on your system. Defaults to ``'/usr/bin/env sass'``. ``SASS_ARGUMENTS`` --------------------------- Additional arguments to use when sass is called. Defaults to ``''``. Stylus compiler =============== The Stylus compiler uses `Stylus `_ to compile your stylesheets. To use it add this to your ``PIPELINE['COMPILERS']`` :: PIPELINE['COMPILERS'] = ( 'pipeline.compilers.stylus.StylusCompiler', ) ``STYLUS_BINARY`` -------------------------- Command line to execute for stylus program. You will most likely change this to the location of stylus on your system. Defaults to ``'/usr/bin/env stylus'``. ``STYLUS_ARGUMENTS`` ----------------------------- Additional arguments to use when stylus is called. Defaults to ``''``. ES6 compiler ============ The ES6 compiler uses `Babel `_ to convert ES6+ code into vanilla ES5. Note that for files to be transpiled properly they must have the file extension **.es6** To use it add this to your ``PIPELINE['COMPILERS']`` :: PIPELINE['COMPILERS'] = ( 'pipeline.compilers.es6.ES6Compiler', ) ``BABEL_BINARY`` -------------------------- Command line to execute for babel program. You will most likely change this to the location of babel on your system. Defaults to ``'/usr/bin/env babel'``. ``BABEL_ARGUMENTS`` ----------------------------- Additional arguments to use when babel is called. Defaults to ``''``. Write your own compiler class ============================= You can write your own compiler class, for example if you want to implement other types of compilers. To do so, you just have to create a class that inherits from ``pipeline.compilers.CompilerBase`` and implements ``match_file`` and ``compile_file`` when needed. Finally, specify it in the tuple of compilers ``PIPELINE['COMPILERS']`` in the settings. Example ------- A custom compiler for an imaginary compiler called jam :: from pipeline.compilers import CompilerBase class JamCompiler(CompilerBase): output_extension = 'js' def match_file(self, filename): return filename.endswith('.jam') def compile_file(self, infile, outfile, outdated=False, force=False): if not outdated and not force: return # No need to recompiled file return jam.compile(infile, outfile) 3rd Party Compilers =================== Here is an (in)complete list of 3rd party compilers that integrate with django-pipeline Compass (requires RubyGem) -------------------------- :Creator: `Mila Labs `_ :Description: Compass compiler for django-pipeline using the original Ruby gem. :Link: `https://github.com/mila-labs/django-pipeline-compass-rubygem` Compass (standalone) -------------------- :Creator: `Vitaly Babiy `_ :Description: django-pipeline-compass is a compiler for `django-pipeline `_. Making it really easy to use scss and compass with out requiring the compass gem. :Link: `https://github.com/vbabiy/django-pipeline-compass` Libsass (standalone) -------------------- :Creator: `Johanderson Mogollon `_ :Description: libsasscompiler is a compiler for `django-pipeline `_. Making it really easy to use scss/sass with the super fast libsass library. :Link: `https://github.com/sonic182/libsasscompiler` ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/docs/compressors.rst0000644000175100017510000001761515061253017020364 0ustar00runnerrunner.. _ref-compressors: =========== Compressors =========== Yuglify compressor ================== The Yuglify compressor uses `yuglify `_ for compressing javascript and stylesheets. To use it for your stylesheets add this to your ``PIPELINE['CSS_COMPRESSOR']`` :: PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.yuglify.YuglifyCompressor' To use it for your javascripts add this to your ``PIPELINE['JS_COMPRESSOR']`` :: PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.yuglify.YuglifyCompressor' ``YUGLIFY_BINARY`` --------------------------- Command line to execute for the Yuglify program. You will most likely change this to the location of yuglify on your system. Defaults to ``'/usr/bin/env yuglify'``. ``YUGLIFY_CSS_ARGUMENTS`` ---------------------------------- Additional arguments to use when compressing CSS. Defaults to ``'--terminal'``. ``YUGLIFY_JS_ARGUMENTS`` --------------------------------- Additional arguments to use when compressing JavaScript. Defaults to ``'--terminal'``. YUI Compressor compressor ========================= The YUI compressor uses `yui-compressor `_ for compressing javascript and stylesheets. To use it for your stylesheets add this to your ``PIPELINE['CSS_COMPRESSOR']`` :: PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.yui.YUICompressor' To use it for your javascripts add this to your ``PIPELINE['JS_COMPRESSOR']`` :: PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.yui.YUICompressor' ``YUI_BINARY`` ----------------------- Command line to execute for the YUI program. You will most likely change this to the location of yui-compressor on your system. Defaults to ``'/usr/bin/env yuicompressor'``. .. warning:: Don't point to ``yuicompressor.jar`` directly, we expect to find a executable script. ``YUI_CSS_ARGUMENTS`` ------------------------------ Additional arguments to use when compressing CSS. Defaults to ``''``. ``YUI_JS_ARGUMENTS`` ----------------------------- Additional arguments to use when compressing JavaScript. Defaults to ``''``. Closure Compiler compressor =========================== The Closure compressor uses `Google Closure Compiler `_ to compress javascripts. To use it add this to your ``PIPELINE['JS_COMPRESSOR']`` :: PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.closure.ClosureCompressor' ``CLOSURE_BINARY`` --------------------------- Command line to execute for the Closure Compiler program. You will most likely change this to the location of closure on your system. Default to ``'/usr/bin/env closure'`` .. warning:: Don't point to ``compiler.jar`` directly, we expect to find a executable script. ``CLOSURE_ARGUMENTS`` ------------------------------ Additional arguments to use when closure is called. Default to ``''`` UglifyJS compressor =================== The UglifyJS compressor uses `UglifyJS `_ to compress javascripts. To use it add this to your ``PIPELINE['JS_COMPRESSOR']`` :: PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.uglifyjs.UglifyJSCompressor' ``UGLIFYJS_BINARY`` ---------------------------- Command line to execute for the UglifyJS program. You will most likely change this to the location of uglifyjs on your system. Defaults to ``'/usr/bin/env uglifyjs'``. ``UGLIFYJS_ARGUMENTS`` ------------------------------- Additional arguments to use when uglifyjs is called. Default to ``''`` JSMin compressor ================ The jsmin compressor uses Douglas Crockford jsmin tool to compress javascripts. To use it add this to your ``PIPELINE['JS_COMPRESSOR']`` :: PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.jsmin.JSMinCompressor' Install the jsmin library with your favorite Python package manager :: pip install jsmin Terser compressor =================== `Terser `_ is a JavaScript parser and mangler/compressor toolkit for ES6+. It has been designed as a successor of ``uglify-es`` and ``uglify-js``. The compressor works with ES5 and ES6 and regular ``.js`` file endings. To use it add this to your ``PIPELINE['JS_COMPRESSOR']`` :: PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.terser.TerserCompressor' ``TERSER_BINARY`` ---------------------------- Command line to execute for the terser program. You will most likely change this to the location of terser on your system. Defaults to ``'/usr/bin/env terser'``. ``TERSER_ARGUMENTS`` ------------------------------- Additional arguments to use when terser is called. Default to ``'--compress'`` CSSTidy compressor ================== The CSStidy compressor uses `CSStidy `_ to compress stylesheets. To us it for your stylesheets add this to your ``PIPELINE['CSS_COMPRESSOR']`` :: PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.csstidy.CSSTidyCompressor' ``CSSTIDY_BINARY`` --------------------------- Command line to execute for csstidy program. You will most likely change this to the location of csstidy on your system. Defaults to ``'/usr/bin/env csstidy'`` ``CSSTIDY_ARGUMENTS`` ------------------------------ Additional arguments to use when csstidy is called. Default to ``'--template=highest'`` CSSMin compressor ================= The cssmin compressor uses the `cssmin `_ command to compress stylesheets. To use it, add this to your ``PIPELINE['CSS_COMPRESSOR']`` :: PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.cssmin.CSSMinCompressor' ``CSSMIN_BINARY`` --------------------------- Command line to execute for cssmin program. You will most likely change this to the location of cssmin on your system. Defaults to ``'/usr/bin/env cssmin'`` ``CSSMIN_ARGUMENTS`` ------------------------------ Additional arguments to use when cssmin is called. Default to ``''`` css-html-js-minify compressor ============================= The css-html-js-minify is full Python compressor using `css-html-js-minify `_ for compressing javascript and stylesheets. To use it for your stylesheets add this to your ``PIPELINE['CSS_COMPRESSOR']`` :: PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.csshtmljsminify.CssHtmlJsMinifyCompressor' To use it for your javascripts add this to your ``PIPELINE['JS_COMPRESSOR']`` :: PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.csshtmljsminify.CssHtmlJsMinifyCompressor' Install the css-html-js-minify library with your favorite Python package manager :: pip install css-html-js-minify No-Op Compressors ================= The No-Op compressor don't perform any operation, when used, only concatenation occurs. This is useful for debugging faulty concatenation due to poorly written javascript and other errors. To use it, add this to your settings :: PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.NoopCompressor' PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.NoopCompressor' Write your own compressor class =============================== You can write your own compressor class, for example if you want to implement other types of compressors. To do so, you just have to create a class that inherits from ``pipeline.compressors.CompressorBase`` and implements ``compress_css`` and/or a ``compress_js`` when needed. Finally, add it to ``PIPELINE['CSS_COMPRESSOR']`` or ``PIPELINE['JS_COMPRESSOR']`` settings (see :doc:`configuration` for more information). Example ------- A custom compressor for an imaginary compressor called jam :: from pipeline.compressors import CompressorBase class JamCompressor(CompressorBase): def compress_js(self, js): return jam.compress(js) def compress_css(self, css): return jam.compress(css) Add it to your settings :: PIPELINE['CSS_COMPRESSOR'] = 'jam.compressors.JamCompressor' PIPELINE['JS_COMPRESSOR'] = 'jam.compressors.JamCompressor' ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/docs/conf.py0000644000175100017510000001611015061253017016537 0ustar00runnerrunner# Pipeline documentation build configuration file, created by # sphinx-quickstart on Sat Apr 30 17:47:55 2011. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) from datetime import datetime from pipeline import __version__ as pipeline_version # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [] # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] # The suffix of source filenames. source_suffix = ".rst" # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = "index" # General information about the project. project = "django-pipeline" current_year = datetime.now().year copyright = "2011-{}, Timothée Peignier".format(current_year) # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The full version, including alpha/beta/rc tags. release = pipeline_version # The short X.Y version. version = ".".join(release.split(".")[:2]) # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ["_build"] # The reST default role (used for this markup: `text`) to use for all documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = "default" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". # html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = "django-pipelinedoc" # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). # latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). # latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ( "index", "django-pipeline.tex", "Pipeline Documentation", "Timothée Peignier", "manual", ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Additional stuff for the LaTeX preamble. # latex_preamble = '' # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ("index", "django-pipeline", "Pipeline Documentation", ["Timothée Peignier"], 1) ] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/docs/configuration.rst0000644000175100017510000001663715061253017020657 0ustar00runnerrunner.. _ref-configuration: ============= Configuration ============= Configuration and list of available settings for Pipeline. Pipeline settings are namespaced in a PIPELINE dictionary in your project settings, e.g.: :: PIPELINE = { 'PIPELINE_ENABLED': True, 'JAVASCRIPT': { 'stats': { 'source_filenames': ( 'js/jquery.js', 'js/d3.js', 'js/collections/*.js', 'js/application.js', ), 'output_filename': 'js/stats.js', } } } Specifying files ================ You specify groups of files to be compressed in your settings. You can use glob syntax to select multiples files. The basic syntax for specifying CSS/JavaScript groups files is :: PIPELINE = { 'STYLESHEETS': { 'colors': { 'source_filenames': ( 'css/core.css', 'css/colors/*.css', 'css/layers.css' ), 'output_filename': 'css/colors.css', 'extra_context': { 'media': 'screen,projection', }, }, }, 'JAVASCRIPT': { 'stats': { 'source_filenames': ( 'js/jquery.js', 'js/d3.js', 'js/collections/*.js', 'js/application.js', ), 'output_filename': 'js/stats.js', } } } Group options ------------- ``source_filenames`` .................... **Required** Is a tuple with the source files to be compressed. The files are concatenated in the order specified in the tuple. ``output_filename`` ................... **Required** Is the filename of the (to be) compressed file. ``variant`` ........... **Optional** Is the variant you want to apply to your CSS. This allow you to embed images and fonts in CSS with data-URI. Allowed values are : ``None`` and ``datauri``. Defaults to ``None``. ``template_name`` ................. **Optional** Name of the template used to render `` ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/jinja2/pipeline/js.jinja0000644000175100017510000000020215061253017022523 0ustar00runnerrunner ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/middleware.py0000644000175100017510000000164015061253017020606 0ustar00runnerrunnerfrom django.core.exceptions import MiddlewareNotUsed from django.utils.deprecation import MiddlewareMixin from django.utils.encoding import DjangoUnicodeDecodeError from django.utils.html import strip_spaces_between_tags as minify_html from pipeline.conf import settings class MinifyHTMLMiddleware(MiddlewareMixin): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) if not settings.PIPELINE_ENABLED: raise MiddlewareNotUsed def process_response(self, request, response): if ( response.has_header("Content-Type") and "text/html" in response["Content-Type"] ): try: response.content = minify_html(response.content.decode("utf-8").strip()) response["Content-Length"] = str(len(response.content)) except DjangoUnicodeDecodeError: pass return response ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/packager.py0000644000175100017510000001317115061253017020250 0ustar00runnerrunnerfrom django.contrib.staticfiles.finders import find, get_finders from django.contrib.staticfiles.storage import staticfiles_storage from django.core.files.base import ContentFile from django.utils.encoding import smart_bytes from pipeline.compilers import Compiler from pipeline.compressors import Compressor from pipeline.conf import settings from pipeline.exceptions import PackageNotFound from pipeline.glob import glob from pipeline.signals import css_compressed, js_compressed class Package: def __init__(self, config): self.config = config self._sources = [] @property def sources(self): if not self._sources: paths = [] for pattern in self.config.get("source_filenames", []): for path in glob(pattern): if path not in paths and find(path): paths.append(str(path)) self._sources = paths return self._sources @property def paths(self): return [ path for path in self.sources if not path.endswith(settings.TEMPLATE_EXT) ] @property def templates(self): return [path for path in self.sources if path.endswith(settings.TEMPLATE_EXT)] @property def output_filename(self): return self.config.get("output_filename") @property def extra_context(self): return self.config.get("extra_context", {}) @property def template_name(self): return self.config.get("template_name") @property def variant(self): return self.config.get("variant") @property def manifest(self): return self.config.get("manifest", True) @property def compiler_options(self): return self.config.get("compiler_options", {}) class Packager: def __init__( self, storage=None, verbose=False, css_packages=None, js_packages=None, ): if storage is None: storage = staticfiles_storage self.storage = storage self.verbose = verbose self.compressor = Compressor(storage=storage, verbose=verbose) self.compiler = Compiler(storage=storage, verbose=verbose) if css_packages is None: css_packages = settings.STYLESHEETS if js_packages is None: js_packages = settings.JAVASCRIPT self.packages = { "css": self.create_packages(css_packages), "js": self.create_packages(js_packages), } def package_for(self, kind, package_name): try: return self.packages[kind][package_name] except KeyError: raise PackageNotFound( "No corresponding package for {} package name : {}".format( kind, package_name ) ) def individual_url(self, filename): return self.storage.url(filename) def pack_stylesheets(self, package, **kwargs): return self.pack( package, self.compressor.compress_css, css_compressed, output_filename=package.output_filename, variant=package.variant, **kwargs, ) def compile(self, paths, compiler_options={}, force=False): paths = self.compiler.compile( paths, compiler_options=compiler_options, force=force, ) for path in paths: if not self.storage.exists(path): if self.verbose: e = ( "Compiled file '%s' cannot be " "found with packager's storage. Locating it." ) print(e % path) source_storage = self.find_source_storage(path) if source_storage is not None: with source_storage.open(path) as source_file: if self.verbose: print(f"Saving: {path}") self.storage.save(path, source_file) else: raise OSError(f"File does not exist: {path}") return paths def pack(self, package, compress, signal, **kwargs): output_filename = package.output_filename if self.verbose: print(f"Saving: {output_filename}") paths = self.compile( package.paths, compiler_options=package.compiler_options, force=True, ) content = compress(paths, **kwargs) self.save_file(output_filename, content) signal.send(sender=self, package=package, **kwargs) return output_filename def pack_javascripts(self, package, **kwargs): return self.pack( package, self.compressor.compress_js, js_compressed, output_filename=package.output_filename, templates=package.templates, **kwargs, ) def pack_templates(self, package): return self.compressor.compile_templates(package.templates) def save_file(self, path, content): return self.storage.save(path, ContentFile(smart_bytes(content))) def find_source_storage(self, path): for finder in get_finders(): for short_path, storage in finder.list(""): if short_path == path: if self.verbose: print(f"Found storage: {str(self.storage)}") return storage return None def create_packages(self, config): packages = {} if not config: return packages for name in config: packages[name] = Package(config[name]) return packages ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/signals.py0000644000175100017510000000012715061253017020130 0ustar00runnerrunnerfrom django.dispatch import Signal css_compressed = Signal() js_compressed = Signal() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/storage.py0000644000175100017510000000732015061253017020136 0ustar00runnerrunnerimport gzip from io import BytesIO from django import get_version as django_version from django.contrib.staticfiles.storage import ( ManifestStaticFilesStorage, StaticFilesStorage, ) from django.contrib.staticfiles.utils import matches_patterns from django.core.files.base import File _CACHED_STATIC_FILES_STORAGE_AVAILABLE = django_version() < "3.1" if _CACHED_STATIC_FILES_STORAGE_AVAILABLE: from django.contrib.staticfiles.storage import CachedStaticFilesStorage class PipelineMixin: packing = True def post_process(self, paths, dry_run=False, **options): if dry_run: return from pipeline.packager import Packager # noqa: PLC0415 packager = Packager(storage=self) for package_name in packager.packages["css"]: package = packager.package_for("css", package_name) output_file = package.output_filename if self.packing: packager.pack_stylesheets(package) paths[output_file] = (self, output_file) yield output_file, output_file, True for package_name in packager.packages["js"]: package = packager.package_for("js", package_name) output_file = package.output_filename if self.packing: packager.pack_javascripts(package) paths[output_file] = (self, output_file) yield output_file, output_file, True super_class = super() if hasattr(super_class, "post_process"): yield from super_class.post_process(paths.copy(), dry_run, **options) def get_available_name(self, name, max_length=None): if self.exists(name): self.delete(name) return name class GZIPMixin: gzip_patterns = ("*.css", "*.js") def _compress(self, original_file): content = BytesIO() gzip_file = gzip.GzipFile(mode="wb", fileobj=content) gzip_file.write(original_file.read()) gzip_file.close() content.seek(0) return File(content) def post_process(self, paths, dry_run=False, **options): super_class = super() if hasattr(super_class, "post_process"): for name, hashed_name, processed in super_class.post_process( paths.copy(), dry_run, **options ): if hashed_name != name: paths[hashed_name] = (self, hashed_name) yield name, hashed_name, processed if dry_run: return for path in paths: if path: if not matches_patterns(path, self.gzip_patterns): continue original_file = self.open(path) gzipped_path = f"{path}.gz" if self.exists(gzipped_path): self.delete(gzipped_path) gzipped_file = self._compress(original_file) gzipped_path = self.save(gzipped_path, gzipped_file) yield gzipped_path, gzipped_path, True class NonPackagingMixin: packing = False class PipelineStorage(PipelineMixin, StaticFilesStorage): pass class NonPackagingPipelineStorage(NonPackagingMixin, PipelineStorage): pass if _CACHED_STATIC_FILES_STORAGE_AVAILABLE: class PipelineCachedStorage(PipelineMixin, CachedStaticFilesStorage): # Deprecated since Django 2.2 # Removed in Django 3.1 pass class NonPackagingPipelineCachedStorage(NonPackagingMixin, PipelineCachedStorage): # Deprecated since Django 2.2 # Removed in Django 3.1 pass class PipelineManifestStorage(PipelineMixin, ManifestStaticFilesStorage): pass class NonPackagingPipelineManifestStorage( NonPackagingMixin, ManifestStaticFilesStorage ): pass ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.921933 django_pipeline-4.1.0/pipeline/templates/0000755000175100017510000000000015061253033020112 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757763098.9389331 django_pipeline-4.1.0/pipeline/templates/pipeline/0000755000175100017510000000000015061253033021717 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/templates/pipeline/compile_error.html0000644000175100017510000000202415061253017025446 0ustar00runnerrunner ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/templates/pipeline/css.html0000644000175100017510000000027615061253017023404 0ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/templates/pipeline/css.jinja0000644000175100017510000000023515061253017023526 0ustar00runnerrunner ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/templates/pipeline/inline_js.html0000644000175100017510000000017315061253017024562 0ustar00runnerrunner {{ source|safe }} ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/templates/pipeline/inline_js.jinja0000644000175100017510000000017415061253017024712 0ustar00runnerrunner {{ source|safe }} ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/templates/pipeline/js.html0000644000175100017510000000020115061253017023214 0ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/templates/pipeline/js.jinja0000644000175100017510000000020215061253017023344 0ustar00runnerrunner ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757763098.9389331 django_pipeline-4.1.0/pipeline/templatetags/0000755000175100017510000000000015061253033020606 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/templatetags/__init__.py0000644000175100017510000000000015061253017022707 0ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/templatetags/pipeline.py0000644000175100017510000001753115061253017022776 0ustar00runnerrunnerimport logging import re import subprocess from django import template from django.contrib.staticfiles.storage import staticfiles_storage from django.template.base import VariableDoesNotExist from django.template.loader import render_to_string from django.utils.safestring import mark_safe from ..collector import default_collector from ..conf import settings from ..exceptions import CompilerError from ..packager import PackageNotFound, Packager from ..utils import guess_type logger = logging.getLogger(__name__) register = template.Library() class PipelineMixin: request = None _request_var = None @property def request_var(self): if not self._request_var: self._request_var = template.Variable("request") return self._request_var def package_for(self, package_name, package_type): package = { "js": getattr(settings, "JAVASCRIPT", {}).get(package_name, {}), "css": getattr(settings, "STYLESHEETS", {}).get(package_name, {}), }[package_type] if package: package = {package_name: package} packager = { "js": Packager(css_packages={}, js_packages=package), "css": Packager(css_packages=package, js_packages={}), }[package_type] return packager.package_for(package_type, package_name) def render(self, context): try: self.request = self.request_var.resolve(context) except VariableDoesNotExist: pass def render_compressed(self, package, package_name, package_type): """Render HTML for the package. If ``PIPELINE_ENABLED`` is ``True``, this will render the package's output file (using :py:meth:`render_compressed_output`). Otherwise, this will render the package's source files (using :py:meth:`render_compressed_sources`). Subclasses can override this method to provide custom behavior for determining what to render. """ if settings.PIPELINE_ENABLED: return self.render_compressed_output(package, package_name, package_type) else: return self.render_compressed_sources(package, package_name, package_type) def render_compressed_output(self, package, package_name, package_type): """Render HTML for using the package's output file. Subclasses can override this method to provide custom behavior for rendering the output file. """ method = getattr(self, f"render_{package_type}") return method(package, package.output_filename) def render_compressed_sources(self, package, package_name, package_type): """Render HTML for using the package's list of source files. Each source file will first be collected, if ``PIPELINE_COLLECTOR_ENABLED`` is ``True``. If there are any errors compiling any of the source files, an ``SHOW_ERRORS_INLINE`` is ``True``, those errors will be shown at the top of the page. Subclasses can override this method to provide custom behavior for rendering the source files. """ if settings.PIPELINE_COLLECTOR_ENABLED: default_collector.collect(self.request) packager = Packager() method = getattr(self, f"render_individual_{package_type}") try: paths = packager.compile(package.paths) except CompilerError as e: if settings.SHOW_ERRORS_INLINE: method = getattr(self, f"render_error_{package_type}") return method(package_name, e) else: raise templates = packager.pack_templates(package) return method(package, paths, templates=templates) def render_error(self, package_type, package_name, e): # Remove any ANSI escape sequences in the output. error_output = re.sub( re.compile(r"(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]"), "", e.error_output, ) return render_to_string( "pipeline/compile_error.html", { "package_type": package_type, "package_name": package_name, "command": subprocess.list2cmdline(e.command), "errors": error_output, }, ) class StylesheetNode(PipelineMixin, template.Node): def __init__(self, name): self.name = name def render(self, context): super().render(context) package_name = template.Variable(self.name).resolve(context) try: package = self.package_for(package_name, "css") except PackageNotFound: w = "Package %r is unknown. Check PIPELINE['STYLESHEETS'] in your settings." logger.warning(w, package_name) # fail silently, do not return anything if an invalid group is specified return "" return self.render_compressed(package, package_name, "css") def render_css(self, package, path): template_name = package.template_name or "pipeline/css.html" context = package.extra_context context.update( { "type": guess_type(path, "text/css"), "url": mark_safe(staticfiles_storage.url(path)), } ) return render_to_string(template_name, context) def render_individual_css(self, package, paths, **kwargs): tags = [self.render_css(package, path) for path in paths] return "\n".join(tags) def render_error_css(self, package_name, e): return super().render_error("CSS", package_name, e) class JavascriptNode(PipelineMixin, template.Node): def __init__(self, name): self.name = name def render(self, context): super().render(context) package_name = template.Variable(self.name).resolve(context) try: package = self.package_for(package_name, "js") except PackageNotFound: w = "Package %r is unknown. Check PIPELINE['JAVASCRIPT'] in your settings." logger.warning(w, package_name) # fail silently, do not return anything if an invalid group is specified return "" return self.render_compressed(package, package_name, "js") def render_js(self, package, path): template_name = package.template_name or "pipeline/js.html" context = package.extra_context context.update( { "type": guess_type(path, "text/javascript"), "url": mark_safe(staticfiles_storage.url(path)), } ) return render_to_string(template_name, context) def render_inline(self, package, js): context = package.extra_context context.update({"source": js}) return render_to_string("pipeline/inline_js.html", context) def render_individual_js(self, package, paths, templates=None): tags = [self.render_js(package, js) for js in paths] if templates: tags.append(self.render_inline(package, templates)) return "\n".join(tags) def render_error_js(self, package_name, e): return super().render_error("JavaScript", package_name, e) @register.tag def stylesheet(parser, token): try: tag_name, name = token.split_contents() except ValueError: e = ( "%r requires exactly one argument: the name " "of a group in the PIPELINE.STYLESHEETS setting" ) raise template.TemplateSyntaxError(e % token.split_contents()[0]) return StylesheetNode(name) @register.tag def javascript(parser, token): try: tag_name, name = token.split_contents() except ValueError: e = ( "%r requires exactly one argument: the name " "of a group in the PIPELINE.JAVASVRIPT setting" ) raise template.TemplateSyntaxError(e % token.split_contents()[0]) return JavascriptNode(name) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/utils.py0000644000175100017510000000377015061253017017637 0ustar00runnerrunnertry: import fcntl except ImportError: # windows fcntl = None import importlib import mimetypes import os import posixpath import sys from urllib.parse import quote from django.utils.encoding import smart_str from pipeline.conf import settings def to_class(class_str): if not class_str: return None module_bits = class_str.split(".") module_path, class_name = ".".join(module_bits[:-1]), module_bits[-1] module = importlib.import_module(module_path) return getattr(module, class_name, None) def filepath_to_uri(path): if path is None: return path return quote(smart_str(path).replace("\\", "/"), safe="/~!*()'#?") def guess_type(path, default=None): for type, ext in settings.MIMETYPES: mimetypes.add_type(type, ext) mimetype, _ = mimetypes.guess_type(path) if not mimetype: return default return smart_str(mimetype) def relpath(path, start=posixpath.curdir): """Return a relative version of a path""" if not path: raise ValueError("no path specified") start_list = posixpath.abspath(start).split(posixpath.sep) path_list = posixpath.abspath(path).split(posixpath.sep) # Work out how much of the filepath is shared by start and path. i = len(posixpath.commonprefix([start_list, path_list])) rel_list = [posixpath.pardir] * (len(start_list) - i) + path_list[i:] if not rel_list: return posixpath.curdir return posixpath.join(*rel_list) def set_std_streams_blocking(): """ Set stdout and stderr to be blocking. This is called after Popen.communicate() to revert stdout and stderr back to be blocking (the default) in the event that the process to which they were passed manipulated one or both file descriptors to be non-blocking. """ if not fcntl: return for f in (sys.__stdout__, sys.__stderr__): fileno = f.fileno() flags = fcntl.fcntl(fileno, fcntl.F_GETFL) fcntl.fcntl(fileno, fcntl.F_SETFL, flags & ~os.O_NONBLOCK) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pipeline/views.py0000644000175100017510000000311115061253017017621 0ustar00runnerrunnerfrom django.conf import settings as django_settings from django.core.exceptions import ImproperlyConfigured from django.views.static import serve from .collector import default_collector from .conf import settings def serve_static(request, path, insecure=False, **kwargs): """Collect and serve static files. This view serves up static files, much like Django's :py:func:`~django.views.static.serve` view, with the addition that it collects static files first (if enabled). This allows images, fonts, and other assets to be served up without first loading a page using the ``{% javascript %}`` or ``{% stylesheet %}`` template tags. You can use this view by adding the following to any :file:`urls.py`:: urlpatterns += static('static/', view='pipeline.views.serve_static') """ # Follow the same logic Django uses for determining access to the # static-serving view. if not django_settings.DEBUG and not insecure: raise ImproperlyConfigured( "The staticfiles view can only be used in " "debug mode or if the --insecure " "option of 'runserver' is used" ) if not settings.PIPELINE_ENABLED and settings.PIPELINE_COLLECTOR_ENABLED: # Collect only the requested file, in order to serve the result as # fast as possible. This won't interfere with the template tags in any # way, as those will still cause Django to collect all media. default_collector.collect(request, files=[path]) return serve(request, path, document_root=django_settings.STATIC_ROOT, **kwargs) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/pyproject.toml0000644000175100017510000000441115061253017017225 0ustar00runnerrunner[build-system] requires = ["setuptools>=64", "setuptools_scm[toml]>=8"] build-backend = "setuptools.build_meta" [project] name = "django-pipeline" requires-python = ">=3.9" version = "4.1.0" description = "Pipeline is an asset packaging library for Django." readme = "README.rst" authors = [{ "name" = "Timothée Peignier", "email" = "timothee.peignier@tryphon.org" }] license = { text = "MIT" } classifiers = [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 4.0", "Framework :: Django :: 4.1", "Framework :: Django :: 4.2", "Framework :: Django :: 5.0", "Framework :: Django :: 5.1", "Framework :: Django :: 5.2", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Utilities", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", ] keywords = [ "django", "pipeline", "asset", "compiling", "concatenation", "compression", "packaging", ] dependencies = [ # indirect dependencies "setuptools", "wheel", ] [project.optional-dependencies] testing = [ "coveralls", "tox", "wheel", "django", ] [project.urls] homepage = "https://github.com/jazzband/django-pipeline/" documentation = "https://django-pipeline.readthedocs.io/" repository = "https://github.com/jazzband/django-pipeline" changelog = "https://github.com/jazzband/django-pipeline/blob/master/HISTORY.rst" [tool.setuptools] include-package-data = true [tool.setuptools.packages.find] exclude = ["tests", "tests.tests"] [tool.setuptools_scm] local_scheme = "dirty-tag" [tool.black] line-length = 88 target-version = ["py39"] [tool.isort] profile = "black" ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757763098.9519331 django_pipeline-4.1.0/setup.cfg0000644000175100017510000000004615061253033016130 0ustar00runnerrunner[egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.939933 django_pipeline-4.1.0/tests/0000755000175100017510000000000015061253033015451 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/__init__.py0000644000175100017510000000000015061253017017552 0ustar00runnerrunner././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.925933 django_pipeline-4.1.0/tests/assets/0000755000175100017510000000000015061253033016753 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.923933 django_pipeline-4.1.0/tests/assets/compilers/0000755000175100017510000000000015061253033020750 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.939933 django_pipeline-4.1.0/tests/assets/compilers/coffee/0000755000175100017510000000000015061253033022177 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/coffee/expected.js0000644000175100017510000000023215061253017024335 0ustar00runnerrunner(function() { var cube, square; square = function(x) { return x * x; }; cube = function(x) { return square(x) * x; }; }).call(this); ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/coffee/input.coffee0000644000175100017510000000006415061253017024511 0ustar00runnerrunnersquare = (x) -> x * x cube = (x) -> square(x) * x ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.940933 django_pipeline-4.1.0/tests/assets/compilers/es6/0000755000175100017510000000000015061253033021445 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/es6/expected.js0000644000175100017510000000073315061253017023611 0ustar00runnerrunner"use strict"; // Expression bodies var odds = evens.map(function (v) { return v + 1; }); var nums = evens.map(function (v, i) { return v + i; }); // Statement bodies nums.forEach(function (v) { if (v % 5 === 0) fives.push(v); }); // Lexical this var bob = { _name: "Bob", _friends: [], printFriends: function printFriends() { var _this = this; this._friends.forEach(function (f) { return console.log(_this._name + " knows " + f); }); } }; ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/es6/input.es60000644000175100017510000000052715061253017023231 0ustar00runnerrunner// Expression bodies var odds = evens.map(v => v + 1); var nums = evens.map((v, i) => v + i); // Statement bodies nums.forEach(v => { if (v % 5 === 0) fives.push(v); }); // Lexical this var bob = { _name: "Bob", _friends: [], printFriends() { this._friends.forEach(f => console.log(this._name + " knows " + f)); } }; ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.940933 django_pipeline-4.1.0/tests/assets/compilers/less/0000755000175100017510000000000015061253033021716 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/less/expected.css0000644000175100017510000000002515061253017024230 0ustar00runnerrunner.a { width: 1px; } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/less/input.less0000644000175100017510000000004615061253017023747 0ustar00runnerrunner@a: 1; .a { width: (@a + 0px); } ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.940933 django_pipeline-4.1.0/tests/assets/compilers/livescript/0000755000175100017510000000000015061253033023134 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/livescript/expected.js0000644000175100017510000000013215061253017025271 0ustar00runnerrunner(function(){ var times; times = function(x, y){ return x * y; }; }).call(this); ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/livescript/input.ls0000644000175100017510000000003215061253017024630 0ustar00runnerrunnertimes = (x, y) -> x * y ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.940933 django_pipeline-4.1.0/tests/assets/compilers/scss/0000755000175100017510000000000015061253033021723 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/scss/expected.css0000644000175100017510000000013715061253017024241 0ustar00runnerrunner.a .b { display: none; } .c .d { display: block; } /*# sourceMappingURL=input.css.map */ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/scss/input.scss0000644000175100017510000000013315061253017023756 0ustar00runnerrunner.a { .b { display: none; } } .c { .d { display: block; } } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757763098.9419332 django_pipeline-4.1.0/tests/assets/compilers/stylus/0000755000175100017510000000000015061253033022313 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/stylus/expected.css0000644000175100017510000000002615061253017024626 0ustar00runnerrunner.a { color: #000; } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/stylus/input.styl0000644000175100017510000000002315061253017024364 0ustar00runnerrunner.a color: black././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757763098.9419332 django_pipeline-4.1.0/tests/assets/compilers/typescript/0000755000175100017510000000000015061253033023156 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/typescript/expected.js0000644000175100017510000000023215061253017025314 0ustar00runnerrunnerfunction getName(u) { return "".concat(u.firstName, " ").concat(u.lastName); } var userName = getName({ firstName: "Django", lastName: "Pipeline" }); ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compilers/typescript/input.ts0000644000175100017510000000037615061253017024675 0ustar00runnerrunnertype FullName = string; interface User { firstName: string; lastName: string; } function getName(u: User): FullName { return `${u.firstName} ${u.lastName}`; } let userName: FullName = getName({firstName: "Django", lastName: "Pipeline"}); ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.943933 django_pipeline-4.1.0/tests/assets/compressors/0000755000175100017510000000000015061253033021332 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compressors/closure.js0000644000175100017510000000023515061253017023346 0ustar00runnerrunner(function(){(function(){window.concat=function(){console.log(arguments)}})();(function(){window.cat=function(){console.log("hello world")}})()}).call(this); ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compressors/csshtmljsminify.css0000644000175100017510000000010115061253017025264 0ustar00runnerrunner@charset "utf-8";.concat{display:none}.concatenate{display:block}././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compressors/csshtmljsminify.js0000644000175100017510000000023715061253017025122 0ustar00runnerrunner(function(){(function(){window.concat=function(){console.log(arguments);}}());(function(){window.cat=function(){console.log("hello world");}}());}).call(this);././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compressors/cssmin.css0000644000175100017510000000006015061253017023336 0ustar00runnerrunner.concat{display:none}.concatenate{display:block}././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compressors/csstidy.css0000644000175100017510000000006215061253017023526 0ustar00runnerrunner.concat{display:none;}.concatenate{display:block;}././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compressors/jsmin.js0000644000175100017510000000023715061253017023014 0ustar00runnerrunner(function(){(function(){window.concat=function(){console.log(arguments);}}());(function(){window.cat=function(){console.log("hello world");}}());}).call(this);././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compressors/slimit.js0000644000175100017510000000024115061253017023170 0ustar00runnerrunner(function(){(function(){window.concat=function(){console.log(arguments);};}());(function(){window.cat=function(){console.log("hello world");};}());}).call(this);././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compressors/terser.js0000644000175100017510000000017515061253017023201 0ustar00runnerrunner(function(){window.concat=function(){console.log(arguments)},window.cat=function(){console.log("hello world")}}).call(this); ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compressors/uglifyjs.js0000644000175100017510000000023515061253017023526 0ustar00runnerrunner(function(){(function(){window.concat=function(){console.log(arguments)}})();(function(){window.cat=function(){console.log("hello world")}})()}).call(this); ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compressors/yuglify.css0000644000175100017510000000006115061253017023533 0ustar00runnerrunner.concat{display:none}.concatenate{display:block} ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compressors/yuglify.js0000644000175100017510000000023215061253017023357 0ustar00runnerrunner(function(){!function(){window.concat=function(){console.log(arguments)}}(),function(){window.cat=function(){console.log("hello world")}}()}).call(this); ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compressors/yui.css0000644000175100017510000000006015061253017022650 0ustar00runnerrunner.concat{display:none}.concatenate{display:block}././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/compressors/yui.js0000644000175100017510000000023415061253017022477 0ustar00runnerrunner(function(){(function(){window.concat=function(){console.log(arguments)}}());(function(){window.cat=function(){console.log("hello world")}}())}).call(this);././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757763098.9449332 django_pipeline-4.1.0/tests/assets/css/0000755000175100017510000000000015061253033017543 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/css/first.css0000644000175100017510000000003515061253017021404 0ustar00runnerrunner.concat { display: none; } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757763098.9449332 django_pipeline-4.1.0/tests/assets/css/nested/0000755000175100017510000000000015061253033021025 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/css/nested/nested.css0000644000175100017510000000463515061253017023033 0ustar00runnerrunner.data-url { background-image: url(data:image/svg+xml;charset=US-ASCII,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20width%3D%2212px%22%20height%3D%2214px%22%20viewBox%3D%220%200%2012%2014%22%20style%3D%22enable-background%3Anew%200%200%2012%2014%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20d%3D%22M11%2C6V5c0-2.762-2.239-5-5-5S1%2C2.238%2C1%2C5v1H0v8h12V6H11z%20M6.5%2C9.847V12h-1V9.847C5.207%2C9.673%2C5%2C9.366%2C5%2C9%20c0-0.553%2C0.448-1%2C1-1s1%2C0.447%2C1%2C1C7%2C9.366%2C6.793%2C9.673%2C6.5%2C9.847z%20M9%2C6H3V5c0-1.657%2C1.343-3%2C3-3s3%2C1.343%2C3%2C3V6z%22%2F%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3C%2Fsvg%3E); } .data-url-quoted { background-image: url('data:image/svg+xml;charset=US-ASCII,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20width%3D%2212px%22%20height%3D%2214px%22%20viewBox%3D%220%200%2012%2014%22%20style%3D%22enable-background%3Anew%200%200%2012%2014%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20d%3D%22M11%2C6V5c0-2.762-2.239-5-5-5S1%2C2.238%2C1%2C5v1H0v8h12V6H11z%20M6.5%2C9.847V12h-1V9.847C5.207%2C9.673%2C5%2C9.366%2C5%2C9%20c0-0.553%2C0.448-1%2C1-1s1%2C0.447%2C1%2C1C7%2C9.366%2C6.793%2C9.673%2C6.5%2C9.847z%20M9%2C6H3V5c0-1.657%2C1.343-3%2C3-3s3%2C1.343%2C3%2C3V6z%22%2F%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3C%2Fsvg%3E'); } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/css/second.css0000644000175100017510000000004315061253017021527 0ustar00runnerrunner.concatenate { display: block; } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/css/sourcemap.css0000644000175100017510000000057215061253017022261 0ustar00runnerrunnerdiv { display: inline; } span { display: block; } //# sourceMappingURL=sourcemap1.css.map //@ sourceMappingURL=sourcemap2.css.map /*# sourceMappingURL=sourcemap3.css.map */ /*@ sourceMappingURL=sourcemap4.css.map */ //# sourceURL=sourcemap5.css.map //@ sourceURL=sourcemap6.css.map /*# sourceURL=sourcemap7.css.map */ /*@ sourceURL=sourcemap8.css.map */ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/css/unicode.css0000644000175100017510000000007315061253017021705 0ustar00runnerrunner.some_class { // Some unicode content: "áéíóú"; } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/css/urls.css0000644000175100017510000000247315061253017021252 0ustar00runnerrunner.embedded-url-svg { background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E% 3C/svg%3E"); } @font-face { font-family: 'Pipeline'; src: url('../fonts/pipeline.eot'); src: url('../fonts/pipeline.eot?#iefix') format('embedded-opentype'); src: local('☺'), url('../fonts/pipeline.woff') format('woff'), url('../fonts/pipeline.ttf') format('truetype'), url('../fonts/pipeline.svg#IyfZbseF') format('svg'); font-weight: normal; font-style: normal; } .relative-url { background-image: url(../images/sprite-buttons.png); } .relative-url-querystring { background-image: url(../images/sprite-buttons.png?v=1.0#foo=bar); } .absolute-url { background-image: url(/images/sprite-buttons.png); } .absolute-full-url { background-image: url(http://localhost/images/sprite-buttons.png); } .no-protocol-url { background-image: url(//images/sprite-buttons.png); } .anchor-tag-url { background-image: url(#image-gradient); } @font-face{src:url(../fonts/pipeline.eot);src:url(../fonts/pipeline.eot?#iefix) format('embedded-opentype'),url(../fonts/pipeline.woff) format('woff'),url(../fonts/pipeline.ttf) format('truetype');} ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.945933 django_pipeline-4.1.0/tests/assets/fonts/0000755000175100017510000000000015061253033020104 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/fonts/pipeline.eot0000644000175100017510000000000015061253017022412 0ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/fonts/pipeline.svg0000644000175100017510000000000015061253017022422 0ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/fonts/pipeline.ttf0000644000175100017510000000000015061253017022420 0ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/fonts/pipeline.woff0000644000175100017510000000000015061253017022564 0ustar00runnerrunner././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.945933 django_pipeline-4.1.0/tests/assets/images/0000755000175100017510000000000015061253033020220 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/images/arrow.png0000644000175100017510000000015315061253017022061 0ustar00runnerrunnerPNG  IHDR Ǵ2IDATxڅ 0 BNo!!􎤵w$ F0A"CD ]r +rIENDB`././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.945933 django_pipeline-4.1.0/tests/assets/images/embed/0000755000175100017510000000000015061253033021274 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/images/embed/arrow.png0000644000175100017510000000015315061253017023135 0ustar00runnerrunnerPNG  IHDR Ǵ2IDATxڅ 0 BNo!!􎤵w$ F0A"CD ]r +rIENDB`././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/images/sprite-buttons.png0000644000175100017510000000000015061253017023720 0ustar00runnerrunner././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.946933 django_pipeline-4.1.0/tests/assets/js/0000755000175100017510000000000015061253033017367 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/js/application.js0000644000175100017510000000005715061253017022234 0ustar00runnerrunnerfunction test() { alert('this is a test'); } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/js/dummy.coffee0000644000175100017510000000006415061253017021675 0ustar00runnerrunnersquare = (x) -> x * x cube = (x) -> square(x) * x ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/js/first.js0000644000175100017510000000014215061253017021053 0ustar00runnerrunner(function() { window.concat = function() { console.log(arguments); } }()) // No semicolon ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/js/second.js0000644000175100017510000000012415061253017021177 0ustar00runnerrunner(function() { window.cat = function() { console.log("hello world"); } }()); ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/js/sourcemap.js0000644000175100017510000000051415061253017021725 0ustar00runnerrunnerconst abc = 123; //# sourceMappingURL=sourcemap1.js.map //@ sourceMappingURL=sourcemap2.js.map /*# sourceMappingURL=sourcemap3.js.map */ /*@ sourceMappingURL=sourcemap4.js.map */ //# sourceURL=sourcemap5.js.map //@ sourceURL=sourcemap6.js.map /*# sourceURL=sourcemap7.js.map */ /*@ sourceURL=sourcemap8.js.map */ ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.925933 django_pipeline-4.1.0/tests/assets/templates/0000755000175100017510000000000015061253033020751 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.946933 django_pipeline-4.1.0/tests/assets/templates/photo/0000755000175100017510000000000015061253033022102 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/templates/photo/detail.jst0000644000175100017510000000016515061253017024072 0ustar00runnerrunner
<%= caption %> by <%= author %>
././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/templates/photo/list.jst0000644000175100017510000000014415061253017023600 0ustar00runnerrunner
<%= caption %>
././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.946933 django_pipeline-4.1.0/tests/assets/templates/video/0000755000175100017510000000000015061253033022057 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/assets/templates/video/detail.jst0000644000175100017510000000015215061253017024043 0ustar00runnerrunner
././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/models.py0000644000175100017510000000000015061253017017276 0ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/settings.py0000644000175100017510000001535215061253017017673 0ustar00runnerrunnerimport glob import os import shutil def local_path(path): return os.path.join(os.path.dirname(__file__), path) DATABASES = { "default": {"ENGINE": "django.db.backends.sqlite3", "TEST_NAME": ":memory:"} } DEBUG = False SITE_ID = 1 INSTALLED_APPS = [ "django.contrib.contenttypes", "django.contrib.messages", "django.contrib.sites", "django.contrib.sessions", "django.contrib.staticfiles", "django.contrib.auth", "django.contrib.admin", "pipeline", "tests.tests", ] ROOT_URLCONF = "tests.urls" MIDDLEWARE = [ "django.contrib.sessions.middleware.SessionMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", ] MEDIA_URL = "/media/" MEDIA_ROOT = local_path("media") STATICFILES_STORAGE = "pipeline.storage.PipelineStorage" STATIC_ROOT = local_path("static/") STATIC_URL = "/static/" STATICFILES_DIRS = (("pipeline", local_path("assets/")),) STATICFILES_FINDERS = ( "django.contrib.staticfiles.finders.FileSystemFinder", "django.contrib.staticfiles.finders.AppDirectoriesFinder", "pipeline.finders.PipelineFinder", ) SECRET_KEY = "django-pipeline" PIPELINE = { "PIPELINE_ENABLED": True, "JS_COMPRESSOR": None, "CSS_COMPRESSOR": None, "STYLESHEETS": { "screen": { "source_filenames": ( "pipeline/css/first.css", "pipeline/css/second.css", "pipeline/css/urls.css", ), "output_filename": "screen.css", }, "screen_media": { "source_filenames": ( "pipeline/css/first.css", "pipeline/css/second.css", "pipeline/css/urls.css", ), "output_filename": "screen_media.css", "extra_context": { "media": "screen and (min-width:500px)", }, }, "screen_title": { "source_filenames": ( "pipeline/css/first.css", "pipeline/css/second.css", "pipeline/css/urls.css", ), "output_filename": "screen_title.css", "extra_context": { "title": "Default Style", }, }, }, "JAVASCRIPT": { "scripts": { "source_filenames": ( "pipeline/js/first.js", "pipeline/js/second.js", "pipeline/js/application.js", "pipeline/templates/**/*.jst", ), "output_filename": "scripts.js", }, "scripts_async": { "source_filenames": ( "pipeline/js/first.js", "pipeline/js/second.js", "pipeline/js/application.js", "pipeline/templates/**/*.jst", ), "output_filename": "scripts_async.js", "extra_context": { "async": True, }, }, "scripts_defer": { "source_filenames": ( "pipeline/js/first.js", "pipeline/js/second.js", "pipeline/js/application.js", "pipeline/templates/**/*.jst", ), "output_filename": "scripts_defer.js", "extra_context": { "defer": True, }, }, "scripts_async_defer": { "source_filenames": ( "pipeline/js/first.js", "pipeline/js/second.js", "pipeline/js/application.js", "pipeline/templates/**/*.jst", ), "output_filename": "scripts_async_defer.js", "extra_context": { "async": True, "defer": True, }, }, }, } NODE_MODULES_PATH = local_path("../node_modules") NODE_BIN_PATH = os.path.join(NODE_MODULES_PATH, ".bin") NODE_EXE_PATH = shutil.which("node") JAVA_EXE_PATH = shutil.which("java") CSSTIDY_EXE_PATH = shutil.which("csstidy") HAS_NODE = bool(NODE_EXE_PATH) HAS_JAVA = bool(JAVA_EXE_PATH) HAS_CSSTIDY = bool(CSSTIDY_EXE_PATH) if HAS_NODE: def node_exe_path(command): exe_ext = ".cmd" if os.name == "nt" else "" return os.path.join(NODE_BIN_PATH, "{}{}".format(command, exe_ext)) PIPELINE.update( { "SASS_BINARY": node_exe_path("sass"), "COFFEE_SCRIPT_BINARY": node_exe_path("coffee"), "COFFEE_SCRIPT_ARGUMENTS": ["--no-header"], "LESS_BINARY": node_exe_path("lessc"), "BABEL_BINARY": node_exe_path("babel"), "BABEL_ARGUMENTS": ["--presets", "es2015"], "STYLUS_BINARY": node_exe_path("stylus"), "LIVE_SCRIPT_BINARY": node_exe_path("lsc"), "LIVE_SCRIPT_ARGUMENTS": ["--no-header"], "YUGLIFY_BINARY": node_exe_path("yuglify"), "UGLIFYJS_BINARY": node_exe_path("uglifyjs"), "TERSER_BINARY": node_exe_path("terser"), "CSSMIN_BINARY": node_exe_path("cssmin"), "TYPE_SCRIPT_BINARY": node_exe_path("tsc"), } ) if HAS_NODE and HAS_JAVA: PIPELINE.update( { "CLOSURE_BINARY": [ JAVA_EXE_PATH, "-jar", os.path.join( NODE_MODULES_PATH, "google-closure-compiler-java", "compiler.jar", ), ], "YUI_BINARY": [ JAVA_EXE_PATH, "-jar", glob.glob( os.path.join(NODE_MODULES_PATH, "yuicompressor", "build", "*.jar") )[0], ], } ) if HAS_CSSTIDY: PIPELINE.update({"CSSTIDY_BINARY": CSSTIDY_EXE_PATH}) TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", "APP_DIRS": True, "DIRS": [local_path("templates")], "OPTIONS": { "context_processors": [ "django.template.context_processors.request", "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", ] }, }, { "BACKEND": "django.template.backends.jinja2.Jinja2", "APP_DIRS": True, "DIRS": [local_path("templates")], "OPTIONS": {"extensions": ["pipeline.jinja2.PipelineExtension"]}, }, ] LOGGING = { "version": 1, "disable_existing_loggers": False, "handlers": { "console": { "class": "logging.StreamHandler", }, }, "loggers": { "pipeline.templatetags.pipeline": { "handlers": ["console"], "level": "ERROR", }, }, } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757763098.9479332 django_pipeline-4.1.0/tests/templates/0000755000175100017510000000000015061253033017447 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/templates/empty.html0000644000175100017510000000000115061253017021464 0ustar00runnerrunner ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/templates/index.html0000644000175100017510000000031515061253017021445 0ustar00runnerrunner{% load pipeline %} Pipeline {% stylesheet 'screen' %} {% javascript 'scripts' %} ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757763098.949933 django_pipeline-4.1.0/tests/tests/0000755000175100017510000000000015061253033016613 5ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/__init__.py0000644000175100017510000000073615061253017020734 0ustar00runnerrunnerimport os import sys if sys.platform.startswith("win"): os.environ.setdefault("NUMBER_OF_PROCESSORS", "1") from .test_collector import * # noqa from .test_compiler import * # noqa from .test_compressor import * # noqa from .test_glob import * # noqa from .test_middleware import * # noqa from .test_packager import * # noqa from .test_storage import * # noqa from .test_template import * # noqa from .test_utils import * # noqa from .test_views import * # noqa ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/models.py0000644000175100017510000000000015061253017020440 0ustar00runnerrunner././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/test_collector.py0000644000175100017510000000435115061253017022217 0ustar00runnerrunnerimport os from django.contrib.staticfiles import finders from django.core.files.storage import FileSystemStorage from django.test import TestCase from pipeline.collector import default_collector from pipeline.finders import PipelineFinder def local_path(path): return os.path.abspath(os.path.join(os.path.dirname(__file__), "..", path)) class CollectorTest(TestCase): def tearDown(self): super().tearDown() default_collector.clear() def test_collect(self): self.assertEqual( set(default_collector.collect()), set(self._get_collectable_files()) ) def test_collect_with_files(self): self.assertEqual( set( default_collector.collect( files=[ "pipeline/js/first.js", "pipeline/js/second.js", ] ) ), { "pipeline/js/first.js", "pipeline/js/second.js", }, ) def test_delete_file_with_modified(self): list(default_collector.collect()) storage = FileSystemStorage(local_path("assets")) new_mtime = os.path.getmtime(storage.path("js/first.js")) - 1000 os.utime( default_collector.storage.path("pipeline/js/first.js"), (new_mtime, new_mtime), ) self.assertTrue( default_collector.delete_file( "js/first.js", "pipeline/js/first.js", storage ) ) def test_delete_file_with_unmodified(self): list(default_collector.collect(files=["pipeline/js/first.js"])) self.assertFalse( default_collector.delete_file( "js/first.js", "pipeline/js/first.js", FileSystemStorage(local_path("assets")), ) ) def _get_collectable_files(self): for finder in finders.get_finders(): if not isinstance(finder, PipelineFinder): for path, storage in finder.list(["CVS", ".*", "*~"]): if getattr(storage, "prefix", None): yield os.path.join(storage.prefix, path) else: yield path ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/test_compiler.py0000644000175100017510000002311215061253017022037 0ustar00runnerrunnerimport sys from unittest import skipIf, skipUnless from django.conf import settings from django.contrib.staticfiles.storage import staticfiles_storage from django.test import TestCase from django.test.client import RequestFactory from pipeline.collector import default_collector from pipeline.compilers import Compiler, CompilerBase, SubProcessCompiler from pipeline.exceptions import CompilerError from pipeline.utils import to_class from tests.utils import _, pipeline_settings class FailingCompiler(SubProcessCompiler): output_extension = "junk" def match_file(self, path): return path.endswith(".coffee") def compile_file(self, infile, outfile, outdated=False, force=False): command = ( ( "/usr/bin/env", "false", ), ) return self.execute_command(command) class InvalidCompiler(SubProcessCompiler): output_extension = "junk" def match_file(self, path): return path.endswith(".coffee") def compile_file(self, infile, outfile, outdated=False, force=False): command = ( ("this-exists-nowhere-as-a-command-and-should-fail",), infile, outfile, ) return self.execute_command(command) class CompilerWithEmptyFirstArg(SubProcessCompiler): output_extension = "junk" def match_file(self, path): return path.endswith(".coffee") def compile_file(self, infile, outfile, outdated=False, force=False): command = ( ("", "/usr/bin/env", "cat"), infile, ) return self.execute_command(command, stdout_captured=outfile) class CopyingCompiler(SubProcessCompiler): output_extension = "junk" def match_file(self, path): return path.endswith(".coffee") def compile_file(self, infile, outfile, outdated=False, force=False): command = ("cp", infile, outfile) return self.execute_command(command) class LineNumberingCompiler(SubProcessCompiler): output_extension = "junk" def match_file(self, path): return path.endswith(".coffee") def compile_file(self, infile, outfile, outdated=False, force=False): command = ( ("/usr/bin/env", "cat"), ("-n",), infile, ) return self.execute_command(command, stdout_captured=outfile) class DummyCompiler(CompilerBase): output_extension = "js" def match_file(self, path): return path.endswith(".coffee") def compile_file(self, infile, outfile, outdated=False, force=False): return @pipeline_settings(COMPILERS=["tests.tests.test_compiler.DummyCompiler"]) class DummyCompilerTest(TestCase): def setUp(self): default_collector.collect() self.compiler = Compiler() def test_output_path(self): compiler_class = self.compiler.compilers[0] compiler = compiler_class( verbose=self.compiler.verbose, storage=self.compiler.storage, ) output_path = compiler.output_path("js/helpers.coffee", "js") self.assertEqual(output_path, "js/helpers.js") def test_compilers_class(self): compilers_class = self.compiler.compilers self.assertEqual(compilers_class[0], DummyCompiler) def test_compile(self): paths = self.compiler.compile( [ _("pipeline/js/dummy.coffee"), _("pipeline/js/application.js"), ] ) self.assertEqual( [_("pipeline/js/dummy.js"), _("pipeline/js/application.js")], list(paths), ) def tearDown(self): default_collector.clear() @skipIf(sys.platform.startswith("win"), "requires posix platform") @pipeline_settings(COMPILERS=["tests.tests.test_compiler.LineNumberingCompiler"]) class CompilerStdoutTest(TestCase): def setUp(self): default_collector.collect() self.compiler = Compiler() def test_output_path(self): compiler_class = self.compiler.compilers[0] compiler = compiler_class( verbose=self.compiler.verbose, storage=self.compiler.storage, ) output_path = compiler.output_path("js/helpers.coffee", "js") self.assertEqual(output_path, "js/helpers.js") def test_compile(self): paths = self.compiler.compile([_("pipeline/js/dummy.coffee")]) self.assertEqual([_("pipeline/js/dummy.junk")], list(paths)) def tearDown(self): default_collector.clear() @skipIf(sys.platform.startswith("win"), "requires posix platform") @pipeline_settings(COMPILERS=["tests.tests.test_compiler.CopyingCompiler"]) class CompilerSelfWriterTest(TestCase): def setUp(self): default_collector.collect() self.compiler = Compiler() def test_output_path(self): compiler_class = self.compiler.compilers[0] compiler = compiler_class( verbose=self.compiler.verbose, storage=self.compiler.storage, ) output_path = compiler.output_path("js/helpers.coffee", "js") self.assertEqual(output_path, "js/helpers.js") def test_compile(self): paths = self.compiler.compile([_("pipeline/js/dummy.coffee")]) default_collector.collect() self.assertEqual([_("pipeline/js/dummy.junk")], list(paths)) def tearDown(self): default_collector.clear() @pipeline_settings(COMPILERS=["tests.tests.test_compiler.CompilerWithEmptyFirstArg"]) class CompilerWithEmptyFirstArgTest(TestCase): def setUp(self): default_collector.collect() self.compiler = Compiler() def test_compile(self): paths = self.compiler.compile([_("pipeline/js/dummy.coffee")]) default_collector.collect() self.assertEqual([_("pipeline/js/dummy.junk")], list(paths)) def tearDown(self): default_collector.clear() @pipeline_settings(COMPILERS=["tests.tests.test_compiler.InvalidCompiler"]) class InvalidCompilerTest(TestCase): def setUp(self): default_collector.collect() self.compiler = Compiler() def test_compile(self): with self.assertRaises(CompilerError) as cm: self.compiler.compile([_("pipeline/js/dummy.coffee")]) e = cm.exception self.assertEqual( e.command, [ "this-exists-nowhere-as-a-command-and-should-fail", "pipeline/js/dummy.coffee", "pipeline/js/dummy.junk", ], ) self.assertEqual(e.error_output, "") def tearDown(self): default_collector.clear() @skipIf(sys.platform.startswith("win"), "requires posix platform") @pipeline_settings(COMPILERS=["tests.tests.test_compiler.FailingCompiler"]) class FailingCompilerTest(TestCase): def setUp(self): default_collector.collect() self.compiler = Compiler() def test_compile(self): with self.assertRaises(CompilerError) as cm: self.compiler.compile([_("pipeline/js/dummy.coffee")]) e = cm.exception self.assertEqual(e.command, ["/usr/bin/env", "false"]) self.assertEqual(e.error_output, "") def tearDown(self): default_collector.clear() @skipUnless(settings.HAS_NODE, "requires node") class CompilerImplementation(TestCase): def setUp(self): self.compiler = Compiler() default_collector.collect(RequestFactory().get("/")) def tearDown(self): default_collector.clear() def _test_compiler(self, compiler_cls_str, infile, expected): compiler_cls = to_class(compiler_cls_str) compiler = compiler_cls(verbose=False, storage=staticfiles_storage) infile_path = staticfiles_storage.path(infile) outfile_path = compiler.output_path(infile_path, compiler.output_extension) compiler.compile_file(_(infile_path), _(outfile_path), force=True) with open(outfile_path) as f: result = f.read() with staticfiles_storage.open(expected, "r") as f: expected = f.read() self.assertEqual(result, expected) def test_sass(self): self._test_compiler( "pipeline.compilers.sass.SASSCompiler", "pipeline/compilers/scss/input.scss", "pipeline/compilers/scss/expected.css", ) def test_coffeescript(self): self._test_compiler( "pipeline.compilers.coffee.CoffeeScriptCompiler", "pipeline/compilers/coffee/input.coffee", "pipeline/compilers/coffee/expected.js", ) def test_less(self): self._test_compiler( "pipeline.compilers.less.LessCompiler", "pipeline/compilers/less/input.less", "pipeline/compilers/less/expected.css", ) def test_es6(self): self._test_compiler( "pipeline.compilers.es6.ES6Compiler", "pipeline/compilers/es6/input.es6", "pipeline/compilers/es6/expected.js", ) def test_typescript(self): self._test_compiler( "pipeline.compilers.typescript.TypeScriptCompiler", "pipeline/compilers/typescript/input.ts", "pipeline/compilers/typescript/expected.js", ) def test_stylus(self): self._test_compiler( "pipeline.compilers.stylus.StylusCompiler", "pipeline/compilers/stylus/input.styl", "pipeline/compilers/stylus/expected.css", ) def test_livescript(self): self._test_compiler( "pipeline.compilers.livescript.LiveScriptCompiler", "pipeline/compilers/livescript/input.ls", "pipeline/compilers/livescript/expected.js", ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/test_compressor.py0000644000175100017510000006510215061253017022426 0ustar00runnerrunnerimport base64 import os import sys try: from unittest.mock import patch except ImportError: from unittest.mock import patch # noqa from unittest import skipIf, skipUnless from django.conf import settings from django.test import TestCase from django.test.client import RequestFactory from pipeline.collector import default_collector from pipeline.compressors import ( CSS_REWRITE_PATH_RE, JS_REWRITE_PATH_RE, TEMPLATE_FUNC, Compressor, SubProcessCompressor, ) from pipeline.compressors.yuglify import YuglifyCompressor from tests.utils import _, pipeline_settings @pipeline_settings( CSS_COMPRESSOR="pipeline.compressors.yuglify.YuglifyCompressor", JS_COMPRESSOR="pipeline.compressors.yuglify.YuglifyCompressor", ) class CompressorTest(TestCase): def setUp(self): self.maxDiff = None self.compressor = Compressor() default_collector.collect() def test_js_compressor_class(self): self.assertEqual(self.compressor.js_compressor, YuglifyCompressor) def test_css_compressor_class(self): self.assertEqual(self.compressor.css_compressor, YuglifyCompressor) def test_concatenate_and_rewrite(self): css = self.compressor.concatenate_and_rewrite( [_("pipeline/css/first.css"), _("pipeline/css/second.css")], "css/screen.css", ) expected = """.concat {\n display: none;\n}\n\n.concatenate {\n display: block;\n}\n""" # noqa self.assertEqual(expected, css) def test_concatenate(self): js = self.compressor.concatenate( [_("pipeline/js/first.js"), _("pipeline/js/second.js")] ) expected = """(function() {\n window.concat = function() {\n console.log(arguments);\n }\n}()) // No semicolon\n\n;(function() {\n window.cat = function() {\n console.log("hello world");\n }\n}());\n""" # noqa self.assertEqual(expected, js) @patch.object(base64, "b64encode") def test_encoded_content(self, mock): self.compressor.asset_contents.clear() self.compressor.encoded_content(_("pipeline/images/arrow.png")) self.assertTrue(mock.called) mock.reset_mock() self.compressor.encoded_content(_("pipeline/images/arrow.png")) self.assertFalse(mock.called) def test_encoded_content_output(self): self.compressor.asset_contents.clear() encoded = self.compressor.encoded_content(_("pipeline/images/arrow.png")) expected = ( "iVBORw0KGgoAAAANSUhEUgAAAAkAAAAGCAYAAAARx7TFAAAAMk" "lEQVR42oXKwQkAMAxC0Q7rEk5voSEepCHC9/SOpLV3JPULgArV" "RtDIMEEiQ4NECRNdciCfK3K3wvEAAAAASUVORK5CYII=" ) self.assertEqual(encoded, expected) def test_relative_path(self): relative_path = self.compressor.relative_path( "images/sprite.png", "css/screen.css", ) self.assertEqual(relative_path, "../images/sprite.png") def test_base_path(self): base_path = self.compressor.base_path( [_("js/templates/form.jst"), _("js/templates/field.jst")] ) self.assertEqual(base_path, _("js/templates")) def test_absolute_path(self): absolute_path = self.compressor.absolute_path( "../../images/sprite.png", "css/plugins/" ) self.assertEqual(absolute_path, "images/sprite.png") absolute_path = self.compressor.absolute_path( "/images/sprite.png", "css/plugins/" ) self.assertEqual(absolute_path, "/images/sprite.png") def test_template_name(self): name = self.compressor.template_name("templates/photo/detail.jst", "templates/") self.assertEqual(name, "photo_detail") name = self.compressor.template_name("templates/photo_edit.jst", "") self.assertEqual(name, "photo_edit") name = self.compressor.template_name( r"templates\photo\detail.jst", # noqa "templates\\", ) self.assertEqual(name, "photo_detail") @pipeline_settings(TEMPLATE_SEPARATOR="/") def test_template_name_separator(self): name = self.compressor.template_name("templates/photo/detail.jst", "templates/") self.assertEqual(name, "photo/detail") name = self.compressor.template_name("templates/photo_edit.jst", "") self.assertEqual(name, "photo_edit") name = self.compressor.template_name( r"templates\photo\detail.jst", # noqa "templates\\", ) self.assertEqual(name, "photo/detail") def test_compile_templates(self): templates = self.compressor.compile_templates( [_("pipeline/templates/photo/list.jst")] ) self.assertEqual( templates, """window.JST = window.JST || {};\n%s\nwindow.JST[\'list\'] = template(\'
\\n \\n
\\n <%%= caption %%>\\n
\\n
\');\n""" # noqa % TEMPLATE_FUNC, ) templates = self.compressor.compile_templates( [ _("pipeline/templates/video/detail.jst"), _("pipeline/templates/photo/detail.jst"), ] ) self.assertEqual( templates, """window.JST = window.JST || {};\n%s\nwindow.JST[\'video_detail\'] = template(\'
\\n
\');\nwindow.JST[\'photo_detail\'] = template(\'
\\n \\n
\\n <%%= caption %%> by <%%= author %%>\\n
\\n
\');\n""" # noqa % TEMPLATE_FUNC, ) def test_embeddable(self): self.assertFalse( self.compressor.embeddable(_("pipeline/images/sprite.png"), None) ) self.assertFalse( self.compressor.embeddable(_("pipeline/images/arrow.png"), "datauri") ) self.assertTrue( self.compressor.embeddable(_("pipeline/images/embed/arrow.png"), "datauri") ) self.assertFalse( self.compressor.embeddable(_("pipeline/images/arrow.dat"), "datauri") ) def test_construct_asset_path(self): asset_path = self.compressor.construct_asset_path( "../../images/sprite.png", "css/plugins/gallery.css", "css/gallery.css" ) self.assertEqual(asset_path, "../images/sprite.png") asset_path = self.compressor.construct_asset_path( "/images/sprite.png", "css/plugins/gallery.css", "css/gallery.css" ) self.assertEqual(asset_path, "/images/sprite.png") def test_concatenate_with_url_rewrite(self) -> None: output = self.compressor.concatenate( [ _("pipeline/css/urls.css"), ], file_sep="", output_filename="css/screen.css", rewrite_path_re=CSS_REWRITE_PATH_RE, ) self.assertEqual( """.embedded-url-svg { background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E% 3C/svg%3E"); } @font-face { font-family: 'Pipeline'; src: url('../pipeline/fonts/pipeline.eot'); src: url('../pipeline/fonts/pipeline.eot?#iefix') format('embedded-opentype'); src: local('☺'), url('../pipeline/fonts/pipeline.woff') format('woff'), url('../pipeline/fonts/pipeline.ttf') format('truetype'), url('../pipeline/fonts/pipeline.svg#IyfZbseF') format('svg'); font-weight: normal; font-style: normal; } .relative-url { background-image: url(../pipeline/images/sprite-buttons.png); } .relative-url-querystring { background-image: url(../pipeline/images/sprite-buttons.png?v=1.0#foo=bar); } .absolute-url { background-image: url(/images/sprite-buttons.png); } .absolute-full-url { background-image: url(http://localhost/images/sprite-buttons.png); } .no-protocol-url { background-image: url(//images/sprite-buttons.png); } .anchor-tag-url { background-image: url(#image-gradient); } @font-face{src:url(../pipeline/fonts/pipeline.eot);src:url(../pipeline/fonts/pipeline.eot?#iefix) format('embedded-opentype'),url(../pipeline/fonts/pipeline.woff) format('woff'),url(../pipeline/fonts/pipeline.ttf) format('truetype');} """, # noqa output, ) def test_concatenate_with_url_rewrite_data_uri(self): output = self.compressor.concatenate( [ _("pipeline/css/nested/nested.css"), ], file_sep="", output_filename="pipeline/screen.css", rewrite_path_re=CSS_REWRITE_PATH_RE, ) self.assertEqual( """.data-url { background-image: url(data:image/svg+xml;charset=US-ASCII,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20width%3D%2212px%22%20height%3D%2214px%22%20viewBox%3D%220%200%2012%2014%22%20style%3D%22enable-background%3Anew%200%200%2012%2014%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20d%3D%22M11%2C6V5c0-2.762-2.239-5-5-5S1%2C2.238%2C1%2C5v1H0v8h12V6H11z%20M6.5%2C9.847V12h-1V9.847C5.207%2C9.673%2C5%2C9.366%2C5%2C9%20c0-0.553%2C0.448-1%2C1-1s1%2C0.447%2C1%2C1C7%2C9.366%2C6.793%2C9.673%2C6.5%2C9.847z%20M9%2C6H3V5c0-1.657%2C1.343-3%2C3-3s3%2C1.343%2C3%2C3V6z%22%2F%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3C%2Fsvg%3E); } .data-url-quoted { background-image: url('data:image/svg+xml;charset=US-ASCII,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20width%3D%2212px%22%20height%3D%2214px%22%20viewBox%3D%220%200%2012%2014%22%20style%3D%22enable-background%3Anew%200%200%2012%2014%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20d%3D%22M11%2C6V5c0-2.762-2.239-5-5-5S1%2C2.238%2C1%2C5v1H0v8h12V6H11z%20M6.5%2C9.847V12h-1V9.847C5.207%2C9.673%2C5%2C9.366%2C5%2C9%20c0-0.553%2C0.448-1%2C1-1s1%2C0.447%2C1%2C1C7%2C9.366%2C6.793%2C9.673%2C6.5%2C9.847z%20M9%2C6H3V5c0-1.657%2C1.343-3%2C3-3s3%2C1.343%2C3%2C3V6z%22%2F%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3C%2Fsvg%3E'); } """, # noqa output, ) def test_concatenate_css_with_sourcemap(self) -> None: output = self.compressor.concatenate( [ _("pipeline/css/sourcemap.css"), ], file_sep="", output_filename="css/sourcemap-bundle.css", rewrite_path_re=CSS_REWRITE_PATH_RE, ) self.assertEqual( output, "div {\n" " display: inline;\n" "}\n" "\n" "span {\n" " display: block;\n" "}\n" "\n" "\n" "//# sourceMappingURL=../pipeline/css/sourcemap1.css.map\n" "\n" "//@ sourceMappingURL=../pipeline/css/sourcemap2.css.map \n" "\n" "/*# sourceMappingURL=../pipeline/css/sourcemap3.css.map */\n" "\n" "/*@ sourceMappingURL=../pipeline/css/sourcemap4.css.map */\n" "\n" "//# sourceURL=../pipeline/css/sourcemap5.css.map\n" "\n" "//@ sourceURL=../pipeline/css/sourcemap6.css.map \n" "\n" "/*# sourceURL=../pipeline/css/sourcemap7.css.map */\n" "\n" "/*@ sourceURL=../pipeline/css/sourcemap8.css.map */\n", ) def test_concatenate_js_with_sourcemap(self) -> None: output = self.compressor.concatenate( [ _("pipeline/js/sourcemap.js"), ], file_sep=";", output_filename="js/sourcemap-bundle.js", rewrite_path_re=JS_REWRITE_PATH_RE, ) self.assertEqual( output, "const abc = 123;\n" "\n" "\n" "//# sourceMappingURL=../pipeline/js/sourcemap1.js.map\n" "\n" "//@ sourceMappingURL=../pipeline/js/sourcemap2.js.map \n" "\n" "/*# sourceMappingURL=../pipeline/js/sourcemap3.js.map */\n" "\n" "/*@ sourceMappingURL=../pipeline/js/sourcemap4.js.map */\n" "\n" "//# sourceURL=../pipeline/js/sourcemap5.js.map\n" "\n" "//@ sourceURL=../pipeline/js/sourcemap6.js.map \n" "\n" "/*# sourceURL=../pipeline/js/sourcemap7.js.map */\n" "\n" "/*@ sourceURL=../pipeline/js/sourcemap8.js.map */\n", ) def test_concatenate_without_rewrite_path_re(self) -> None: message = ( "Compressor.concatenate() was called without passing " "rewrite_path_re_= or output_filename=. If you are " "specializing Compressor, please update your call " "to remain compatible with future changes." ) with self.assertWarnsMessage(DeprecationWarning, message): output = self.compressor.concatenate( [ _("pipeline/js/sourcemap.js"), ], file_sep=";", output_filename="js/sourcemap-bundle.js", ) self.assertEqual( output, "const abc = 123;\n" "\n" "\n" "//# sourceMappingURL=sourcemap1.js.map\n" "\n" "//@ sourceMappingURL=sourcemap2.js.map \n" "\n" "/*# sourceMappingURL=sourcemap3.js.map */\n" "\n" "/*@ sourceMappingURL=sourcemap4.js.map */\n" "\n" "//# sourceURL=sourcemap5.js.map\n" "\n" "//@ sourceURL=sourcemap6.js.map \n" "\n" "/*# sourceURL=sourcemap7.js.map */\n" "\n" "/*@ sourceURL=sourcemap8.js.map */\n", ) def test_concatenate_without_output_filename(self) -> None: message = ( "Compressor.concatenate() was called without passing " "rewrite_path_re_= or output_filename=. If you are " "specializing Compressor, please update your call " "to remain compatible with future changes." ) with self.assertWarnsMessage(DeprecationWarning, message): output = self.compressor.concatenate( [ _("pipeline/js/sourcemap.js"), ], file_sep=";", rewrite_path_re=JS_REWRITE_PATH_RE, ) self.assertEqual( output, "const abc = 123;\n" "\n" "\n" "//# sourceMappingURL=sourcemap1.js.map\n" "\n" "//@ sourceMappingURL=sourcemap2.js.map \n" "\n" "/*# sourceMappingURL=sourcemap3.js.map */\n" "\n" "/*@ sourceMappingURL=sourcemap4.js.map */\n" "\n" "//# sourceURL=sourcemap5.js.map\n" "\n" "//@ sourceURL=sourcemap6.js.map \n" "\n" "/*# sourceURL=sourcemap7.js.map */\n" "\n" "/*@ sourceURL=sourcemap8.js.map */\n", ) def test_concatenate_without_file_sep(self) -> None: message = ( "Compressor.concatenate() was called without passing " "file_sep=. If you are specializing Compressor, please " "update your call to remain compatible with future changes. " "Defaulting to JavaScript behavior for " "backwards-compatibility." ) with self.assertWarnsMessage(DeprecationWarning, message): output = self.compressor.concatenate( [ _("pipeline/js/first.js"), _("pipeline/js/second.js"), ], output_filename="js/sourcemap-bundle.js", rewrite_path_re=JS_REWRITE_PATH_RE, ) self.assertEqual( output, "(function() {\n" " window.concat = function() {\n" " console.log(arguments);\n" " }\n" "}()) // No semicolon\n" "\n" ";(function() {\n" " window.cat = function() {\n" ' console.log("hello world");\n' " }\n" "}());\n", ) def test_legacy_concatenate_and_rewrite(self) -> None: message = ( "Compressor.concatenate_and_rewrite() is deprecated. Please " "call concatenate() instead." ) with self.assertWarnsMessage(DeprecationWarning, message): output = self.compressor.concatenate_and_rewrite( [ _("pipeline/css/urls.css"), ], "css/screen.css", ) self.assertEqual( """.embedded-url-svg { background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E% 3C/svg%3E"); } @font-face { font-family: 'Pipeline'; src: url('../pipeline/fonts/pipeline.eot'); src: url('../pipeline/fonts/pipeline.eot?#iefix') format('embedded-opentype'); src: local('☺'), url('../pipeline/fonts/pipeline.woff') format('woff'), url('../pipeline/fonts/pipeline.ttf') format('truetype'), url('../pipeline/fonts/pipeline.svg#IyfZbseF') format('svg'); font-weight: normal; font-style: normal; } .relative-url { background-image: url(../pipeline/images/sprite-buttons.png); } .relative-url-querystring { background-image: url(../pipeline/images/sprite-buttons.png?v=1.0#foo=bar); } .absolute-url { background-image: url(/images/sprite-buttons.png); } .absolute-full-url { background-image: url(http://localhost/images/sprite-buttons.png); } .no-protocol-url { background-image: url(//images/sprite-buttons.png); } .anchor-tag-url { background-image: url(#image-gradient); } @font-face{src:url(../pipeline/fonts/pipeline.eot);src:url(../pipeline/fonts/pipeline.eot?#iefix) format('embedded-opentype'),url(../pipeline/fonts/pipeline.woff) format('woff'),url(../pipeline/fonts/pipeline.ttf) format('truetype');} """, # noqa output, ) def test_legacy_concatenate_and_rewrite_with_data_uri(self) -> None: message = ( "Compressor.concatenate_and_rewrite() is deprecated. Please " "call concatenate() instead." ) with self.assertWarnsMessage(DeprecationWarning, message): output = self.compressor.concatenate_and_rewrite( [ _("pipeline/css/nested/nested.css"), ], "pipeline/screen.css", ) self.assertEqual( """.data-url { background-image: url(data:image/svg+xml;charset=US-ASCII,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20width%3D%2212px%22%20height%3D%2214px%22%20viewBox%3D%220%200%2012%2014%22%20style%3D%22enable-background%3Anew%200%200%2012%2014%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20d%3D%22M11%2C6V5c0-2.762-2.239-5-5-5S1%2C2.238%2C1%2C5v1H0v8h12V6H11z%20M6.5%2C9.847V12h-1V9.847C5.207%2C9.673%2C5%2C9.366%2C5%2C9%20c0-0.553%2C0.448-1%2C1-1s1%2C0.447%2C1%2C1C7%2C9.366%2C6.793%2C9.673%2C6.5%2C9.847z%20M9%2C6H3V5c0-1.657%2C1.343-3%2C3-3s3%2C1.343%2C3%2C3V6z%22%2F%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3C%2Fsvg%3E); } .data-url-quoted { background-image: url('data:image/svg+xml;charset=US-ASCII,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20width%3D%2212px%22%20height%3D%2214px%22%20viewBox%3D%220%200%2012%2014%22%20style%3D%22enable-background%3Anew%200%200%2012%2014%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20d%3D%22M11%2C6V5c0-2.762-2.239-5-5-5S1%2C2.238%2C1%2C5v1H0v8h12V6H11z%20M6.5%2C9.847V12h-1V9.847C5.207%2C9.673%2C5%2C9.366%2C5%2C9%20c0-0.553%2C0.448-1%2C1-1s1%2C0.447%2C1%2C1C7%2C9.366%2C6.793%2C9.673%2C6.5%2C9.847z%20M9%2C6H3V5c0-1.657%2C1.343-3%2C3-3s3%2C1.343%2C3%2C3V6z%22%2F%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3C%2Fsvg%3E'); } """, # noqa output, ) @skipIf(sys.platform.startswith("win"), "requires posix platform") def test_compressor_subprocess_unicode(self): path = os.path.dirname(os.path.dirname(__file__)) content = open(path + "/assets/css/unicode.css", encoding="utf-8").read() output = SubProcessCompressor(False).execute_command(("cat",), content) self.assertEqual( """.some_class { // Some unicode content: "áéíóú"; } """, output, ) def tearDown(self): default_collector.clear() class CompressorImplementationTest(TestCase): maxDiff = None def setUp(self): self.compressor = Compressor() default_collector.collect(RequestFactory().get("/")) def tearDown(self): default_collector.clear() def _test_compressor(self, compressor_cls, compress_type, expected_file): override_settings = { (f"{compress_type.upper()}_COMPRESSOR"): compressor_cls, } with pipeline_settings(**override_settings): if compress_type == "js": result = self.compressor.compress_js( [_("pipeline/js/first.js"), _("pipeline/js/second.js")] ) else: result = self.compressor.compress_css( [_("pipeline/css/first.css"), _("pipeline/css/second.css")], os.path.join("pipeline", "css", os.path.basename(expected_file)), ) with self.compressor.storage.open(expected_file, "r") as f: expected = f.read() self.assertEqual(result, expected) def test_jsmin(self): self._test_compressor( "pipeline.compressors.jsmin.JSMinCompressor", "js", "pipeline/compressors/jsmin.js", ) def test_csshtmljsminify(self): self._test_compressor( "pipeline.compressors.csshtmljsminify.CssHtmlJsMinifyCompressor", "css", "pipeline/compressors/csshtmljsminify.css", ) self._test_compressor( "pipeline.compressors.csshtmljsminify.CssHtmlJsMinifyCompressor", "js", "pipeline/compressors/csshtmljsminify.js", ) @skipUnless(settings.HAS_NODE, "requires node") def test_uglifyjs(self): self._test_compressor( "pipeline.compressors.uglifyjs.UglifyJSCompressor", "js", "pipeline/compressors/uglifyjs.js", ) @skipUnless(settings.HAS_NODE, "requires node") def test_terser(self): self._test_compressor( "pipeline.compressors.terser.TerserCompressor", "js", "pipeline/compressors/terser.js", ) @skipUnless(settings.HAS_NODE, "requires node") def test_yuglify(self): self._test_compressor( "pipeline.compressors.yuglify.YuglifyCompressor", "css", "pipeline/compressors/yuglify.css", ) self._test_compressor( "pipeline.compressors.yuglify.YuglifyCompressor", "js", "pipeline/compressors/yuglify.js", ) @skipUnless(settings.HAS_NODE, "requires node") def test_cssmin(self): self._test_compressor( "pipeline.compressors.cssmin.CSSMinCompressor", "css", "pipeline/compressors/cssmin.css", ) @skipUnless(settings.HAS_NODE, "requires node") @skipUnless(settings.HAS_JAVA, "requires java") def test_closure(self): self._test_compressor( "pipeline.compressors.closure.ClosureCompressor", "js", "pipeline/compressors/closure.js", ) @skipUnless(settings.HAS_NODE, "requires node") @skipUnless(settings.HAS_JAVA, "requires java") def test_yui_js(self): self._test_compressor( "pipeline.compressors.yui.YUICompressor", "js", "pipeline/compressors/yui.js", ) @skipUnless(settings.HAS_NODE, "requires node") @skipUnless(settings.HAS_JAVA, "requires java") def test_yui_css(self): self._test_compressor( "pipeline.compressors.yui.YUICompressor", "css", "pipeline/compressors/yui.css", ) @skipUnless(settings.HAS_CSSTIDY, "requires csstidy") def test_csstidy(self): self._test_compressor( "pipeline.compressors.csstidy.CSSTidyCompressor", "css", "pipeline/compressors/csstidy.css", ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/test_conf.py0000644000175100017510000000276015061253017021160 0ustar00runnerrunnerimport sys from unittest import skipIf, skipUnless from django.test import TestCase from pipeline.conf import PipelineSettings class TestSettings(TestCase): def test_3unicode(self): s = PipelineSettings({"FOO_BINARY": "env actualprogram"}) self.assertEqual(s.FOO_BINARY, ("env", "actualprogram")) def test_2unicode(self): s = PipelineSettings({"FOO_BINARY": "env actualprogram"}) self.assertEqual(s.FOO_BINARY, ("env", "actualprogram")) def test_2bytes(self): s = PipelineSettings({"FOO_BINARY": "env actualprogram"}) self.assertEqual(s.FOO_BINARY, ("env", "actualprogram")) def test_expected_splitting(self): s = PipelineSettings({"FOO_BINARY": "env actualprogram"}) self.assertEqual(s.FOO_BINARY, ("env", "actualprogram")) @skipIf(sys.platform.startswith("win"), "requires posix platform") def test_expected_preservation(self): s = PipelineSettings({"FOO_BINARY": r"actual\ program"}) self.assertEqual(s.FOO_BINARY, ("actual program",)) @skipUnless(sys.platform.startswith("win"), "requires windows") def test_win_path_preservation(self): s = PipelineSettings({"FOO_BINARY": "C:\\Test\\ActualProgram.exe argument"}) self.assertEqual(s.FOO_BINARY, ("C:\\Test\\ActualProgram.exe", "argument")) def test_tuples_are_normal(self): s = PipelineSettings({"FOO_ARGUMENTS": ("explicit", "with", "args")}) self.assertEqual(s.FOO_ARGUMENTS, ("explicit", "with", "args")) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/test_forms.py0000644000175100017510000001520115061253017021353 0ustar00runnerrunnerfrom django import get_version as django_version from django.forms import Media from django.test import TestCase from pipeline.forms import PipelineFormMedia from ..utils import pipeline_settings @pipeline_settings( PIPELINE_COLLECTOR_ENABLED=False, STYLESHEETS={ "styles1": { "source_filenames": ( "pipeline/css/first.css", "pipeline/css/second.css", ), "output_filename": "styles1.min.css", }, "styles2": { "source_filenames": ("pipeline/css/unicode.css",), "output_filename": "styles2.min.css", }, "print": { "source_filenames": ("pipeline/css/urls.css",), "output_filename": "print.min.css", }, }, JAVASCRIPT={ "scripts1": { "source_filenames": ( "pipeline/js/first.js", "pipeline/js/second.js", ), "output_filename": "scripts1.min.js", }, "scripts2": { "source_filenames": ("pipeline/js/application.js",), "output_filename": "scripts2.min.js", }, }, ) class PipelineFormMediaTests(TestCase): """Unit tests for pipeline.forms.PipelineFormMedia.""" @pipeline_settings(PIPELINE_ENABLED=True) def test_css_packages_with_pipeline_enabled(self): """Testing PipelineFormMedia.css_packages with PIPELINE_ENABLED=True""" class MyMedia(PipelineFormMedia): css_packages = { "all": ("styles1", "styles2"), "print": ("print",), } css = {"all": ("extra1.css", "extra2.css")} media = Media(MyMedia) self.assertEqual( MyMedia.css, { "all": [ "extra1.css", "extra2.css", "/static/styles1.min.css", "/static/styles2.min.css", ], "print": ["/static/print.min.css"], }, ) self.assertEqual(MyMedia.css, media._css) expected_regex = [ r''.format(path) for path in ( "/static/extra1.css", "/static/extra2.css", "/static/styles1.min.css", "/static/styles2.min.css", ) ] + [ r'' ] for rendered_node, expected_node in zip(media.render_css(), expected_regex): self.assertRegex(rendered_node, expected_node) @pipeline_settings(PIPELINE_ENABLED=False) def test_css_packages_with_pipeline_disabled(self): """Testing PipelineFormMedia.css_packages with PIPELINE_ENABLED=False""" class MyMedia(PipelineFormMedia): css_packages = { "all": ("styles1", "styles2"), "print": ("print",), } css = {"all": ("extra1.css", "extra2.css")} media = Media(MyMedia) self.assertEqual( MyMedia.css, { "all": [ "extra1.css", "extra2.css", "pipeline/css/first.css", "pipeline/css/second.css", "pipeline/css/unicode.css", ], "print": ["pipeline/css/urls.css"], }, ) self.assertEqual(MyMedia.css, media._css) expected_regex = [ ''.format(path) for path in ( "/static/extra1.css", "/static/extra2.css", "/static/pipeline/css/first.css", "/static/pipeline/css/second.css", "/static/pipeline/css/unicode.css", ) ] + [ '' ] for rendered_node, expected_node in zip(media.render_css(), expected_regex): self.assertRegex(rendered_node, expected_node) @pipeline_settings(PIPELINE_ENABLED=True) def test_js_packages_with_pipeline_enabled(self): """Testing PipelineFormMedia.js_packages with PIPELINE_ENABLED=True""" class MyMedia(PipelineFormMedia): js_packages = ("scripts1", "scripts2") js = ("extra1.js", "extra2.js") media = Media(MyMedia) if django_version() < "3.1": script_tag = '' else: script_tag = '' self.assertEqual( MyMedia.js, [ "extra1.js", "extra2.js", "/static/scripts1.min.js", "/static/scripts2.min.js", ], ) self.assertEqual(MyMedia.js, media._js) self.assertEqual( media.render_js(), [ script_tag % path for path in ( "/static/extra1.js", "/static/extra2.js", "/static/scripts1.min.js", "/static/scripts2.min.js", ) ], ) @pipeline_settings(PIPELINE_ENABLED=False) def test_js_packages_with_pipeline_disabled(self): """Testing PipelineFormMedia.js_packages with PIPELINE_ENABLED=False""" class MyMedia(PipelineFormMedia): js_packages = ("scripts1", "scripts2") js = ("extra1.js", "extra2.js") media = Media(MyMedia) if django_version() < "3.1": script_tag = '' else: script_tag = '' self.assertEqual( MyMedia.js, [ "extra1.js", "extra2.js", "pipeline/js/first.js", "pipeline/js/second.js", "pipeline/js/application.js", ], ) self.assertEqual(MyMedia.js, media._js) self.assertEqual( media.render_js(), [ script_tag % path for path in ( "/static/extra1.js", "/static/extra2.js", "/static/pipeline/js/first.js", "/static/pipeline/js/second.js", "/static/pipeline/js/application.js", ) ], ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/test_glob.py0000644000175100017510000000704515061253017021157 0ustar00runnerrunnerimport os import shutil from django.core.files.base import ContentFile from django.core.files.storage import FileSystemStorage from django.test import TestCase from pipeline import glob def local_path(path): return os.path.join(os.path.dirname(__file__), path) class GlobTest(TestCase): def normpath(self, *parts): return os.path.normpath(os.path.join(*parts)) def mktemp(self, *parts): filename = self.normpath(*parts) base, file = os.path.split(filename) base = os.path.join(self.storage.location, base) if not os.path.exists(base): os.makedirs(base) self.storage.save(filename, ContentFile("")) def assertSequenceEqual(self, l1, l2): self.assertEqual(set(l1), set(l2)) def setUp(self): self.storage = FileSystemStorage(local_path("glob_dir")) self.old_storage = glob.staticfiles_storage glob.staticfiles_storage = self.storage self.mktemp("a", "D") self.mktemp("aab", "F") self.mktemp("aaa", "zzzF") self.mktemp("ZZZ") self.mktemp("a", "bcd", "EF") self.mktemp("a", "bcd", "efg", "ha") def glob(self, *parts): if len(parts) == 1: pattern = parts[0] else: pattern = os.path.join(*parts) return glob.glob(pattern) def tearDown(self): shutil.rmtree(self.storage.location) glob.staticfiles_storage = self.old_storage def test_glob_literal(self): self.assertSequenceEqual(self.glob("a"), [self.normpath("a")]) self.assertSequenceEqual(self.glob("a", "D"), [self.normpath("a", "D")]) self.assertSequenceEqual(self.glob("aab"), [self.normpath("aab")]) def test_glob_one_directory(self): self.assertSequenceEqual( self.glob("a*"), map(self.normpath, ["a", "aab", "aaa"]) ) self.assertSequenceEqual(self.glob("*a"), map(self.normpath, ["a", "aaa"])) self.assertSequenceEqual(self.glob("aa?"), map(self.normpath, ["aaa", "aab"])) self.assertSequenceEqual( self.glob("aa[ab]"), map(self.normpath, ["aaa", "aab"]) ) self.assertSequenceEqual(self.glob("*q"), []) def test_glob_nested_directory(self): if os.path.normcase("abCD") == "abCD": # case-sensitive filesystem self.assertSequenceEqual( self.glob("a", "bcd", "E*"), [self.normpath("a", "bcd", "EF")] ) else: # case insensitive filesystem self.assertSequenceEqual( self.glob("a", "bcd", "E*"), [self.normpath("a", "bcd", "EF"), self.normpath("a", "bcd", "efg")], ) self.assertSequenceEqual( self.glob("a", "bcd", "*g"), [self.normpath("a", "bcd", "efg")] ) def test_glob_directory_names(self): self.assertSequenceEqual(self.glob("*", "D"), [self.normpath("a", "D")]) self.assertSequenceEqual(self.glob("*", "*a"), []) self.assertSequenceEqual( self.glob("a", "*", "*", "*a"), [self.normpath("a", "bcd", "efg", "ha")] ) self.assertSequenceEqual( self.glob("?a?", "*F"), map(self.normpath, [os.path.join("aaa", "zzzF"), os.path.join("aab", "F")]), ) def test_glob_directory_with_trailing_slash(self): # We are verifying that when there is wildcard pattern which # ends with os.sep doesn't blow up. paths = glob.glob("*" + os.sep) self.assertEqual(len(paths), 4) self.assertTrue(all(os.sep in path for path in paths)) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/test_middleware.py0000644000175100017510000000300215061253017022336 0ustar00runnerrunnerfrom unittest.mock import patch from django.core.exceptions import MiddlewareNotUsed from django.http import HttpRequest, HttpResponse from django.test import TestCase from pipeline.middleware import MinifyHTMLMiddleware def dummy_get_response(request): return None class MiddlewareTest(TestCase): whitespace = b" " def setUp(self): self.req = HttpRequest() self.req.META = { "SERVER_NAME": "testserver", "SERVER_PORT": 80, } self.req.path = self.req.path_info = "/" self.resp = HttpResponse() self.resp.status_code = 200 self.resp.content = self.whitespace def test_middleware_html(self): self.resp["Content-Type"] = "text/html; charset=UTF-8" response = MinifyHTMLMiddleware(dummy_get_response).process_response( self.req, self.resp ) self.assertIn("text/html", response["Content-Type"]) self.assertNotIn(self.whitespace, response.content) def test_middleware_text(self): self.resp["Content-Type"] = "text/plain; charset=UTF-8" response = MinifyHTMLMiddleware(dummy_get_response).process_response( self.req, self.resp ) self.assertIn("text/plain", response["Content-Type"]) self.assertIn(self.whitespace, response.content) @patch("pipeline.middleware.settings.PIPELINE_ENABLED", False) def test_middleware_not_used(self): self.assertRaises(MiddlewareNotUsed, MinifyHTMLMiddleware, dummy_get_response) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/test_packager.py0000644000175100017510000000254615061253017022012 0ustar00runnerrunnerfrom django.test import TestCase from pipeline.collector import default_collector from pipeline.packager import PackageNotFound, Packager from tests.utils import _ class PackagerTest(TestCase): def setUp(self): default_collector.collect() def test_package_for(self): packager = Packager() packager.packages["js"] = packager.create_packages( { "application": { "source_filenames": (_("pipeline/js/application.js"),), "output_filename": "application.js", } } ) try: packager.package_for("js", "application") except PackageNotFound: self.fail() try: packager.package_for("js", "broken") self.fail() except PackageNotFound: pass def test_templates(self): packager = Packager() packages = packager.create_packages( { "templates": { "source_filenames": (_("pipeline/templates/photo/list.jst"),), "output_filename": "templates.js", } } ) self.assertEqual( packages["templates"].templates, [_("pipeline/templates/photo/list.jst")], ) def tearDown(self): default_collector.clear() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/test_storage.py0000644000175100017510000001146215061253017021676 0ustar00runnerrunnerfrom io import StringIO import django from django.contrib.staticfiles import finders from django.contrib.staticfiles.storage import staticfiles_storage from django.core.management import call_command from django.test import TestCase from django.test.utils import modify_settings, override_settings from pipeline.collector import default_collector from pipeline.storage import PipelineStorage from tests.tests.test_compiler import DummyCompiler from tests.utils import pipeline_settings class PipelineNoPathStorage(PipelineStorage): """Storage without an implemented path method""" def path(self, *args): raise NotImplementedError() def delete(self, *args): return def exists(self, *args): return True def save(self, *args): return def open(self, *args): return StringIO() def listdir(self, *args): return [] class DummyCSSCompiler(DummyCompiler): """Handles css files""" output_extension = "css" def match_file(self, path): return path.endswith(".css") class StorageTest(TestCase): def tearDown(self): staticfiles_storage._setup() @pipeline_settings(JS_COMPRESSOR=None, CSS_COMPRESSOR=None) def test_post_process_dry_run(self): default_collector.collect() processed_files = PipelineStorage().post_process({}, True) self.assertEqual(list(processed_files), []) @pipeline_settings( JS_COMPRESSOR=None, CSS_COMPRESSOR=None, COMPILERS=["tests.tests.test_storage.DummyCSSCompiler"], ) def test_post_process(self): default_collector.collect() storage = PipelineStorage() processed_files = storage.post_process({}) self.assertTrue(("screen.css", "screen.css", True) in processed_files) self.assertTrue(("scripts.js", "scripts.js", True) in processed_files) @override_settings( STATICFILES_STORAGE="tests.tests.test_storage.PipelineNoPathStorage", ) @pipeline_settings( JS_COMPRESSOR=None, CSS_COMPRESSOR=None, COMPILERS=["tests.tests.test_storage.DummyCSSCompiler"], ) def test_post_process_no_path(self): """ Test post_process with a storage that doesn't implement the path method. """ staticfiles_storage._setup() try: call_command("collectstatic", verbosity=0, interactive=False) except NotImplementedError: self.fail("Received an error running collectstatic") @modify_settings(STATICFILES_FINDERS={"append": "pipeline.finders.PipelineFinder"}) def test_nonexistent_file_pipeline_finder(self): path = finders.find("nothing.css") self.assertIsNone(path) @modify_settings(STATICFILES_FINDERS={"append": "pipeline.finders.PipelineFinder"}) def test_nonexistent_file_pipeline_finder_find_all(self): if django.__version__ < "5.2": self.skipTest("Only applicable to Django 5.2 and up") path = finders.find("nothing.css", find_all=True) self.assertIsNotNone(path) self.assertEqual([], path) @modify_settings(STATICFILES_FINDERS={"append": "pipeline.finders.PipelineFinder"}) def test_nonexistent_file_pipeline_finder_all(self): if django.__version__ < "6.0": self.skipTest("Only applicable to versions of Django before 6.0") path = finders.find("nothing.css", all=True) self.assertIsNotNone(path) self.assertEqual([], path) @modify_settings( STATICFILES_FINDERS={"append": "pipeline.finders.CachedFileFinder"} ) def test_nonexistent_file_cached_finder(self): path = finders.find("nothing.css") self.assertIsNone(path) @modify_settings(STATICFILES_FINDERS={"append": "pipeline.finders.PipelineFinder"}) def test_nonexistent_double_extension_file_pipeline_finder(self): path = finders.find("app.css.map") self.assertIsNone(path) @modify_settings( STATICFILES_FINDERS={"append": "pipeline.finders.CachedFileFinder"} ) def test_nonexistent_double_extension_file_cached_finder(self): path = finders.find("app.css.map") self.assertIsNone(path) @modify_settings(STATICFILES_FINDERS={"append": "pipeline.finders.ManifestFinder"}) def test_manifest_finder_finds_stylesheet(self): path = finders.find("screen.css") self.assertIsNotNone(path) path = finders.find("screen.scss") self.assertIsNone(path) @modify_settings(STATICFILES_FINDERS={"append": "pipeline.finders.ManifestFinder"}) def test_manifest_finder_finds_all_stylesheet(self): paths = finders.find("screen.css", all=True) self.assertIsNotNone(paths) self.assertEqual(1, len(paths)) paths = finders.find("screen.scss", all=True) self.assertIsNotNone(paths) self.assertEqual([], paths) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/test_template.py0000644000175100017510000001232115061253017022040 0ustar00runnerrunnerfrom django.template import Context, Template from django.test import TestCase from jinja2 import Environment, PackageLoader from pipeline.jinja2 import PipelineExtension from tests.utils import pipeline_settings class JinjaTest(TestCase): def setUp(self): self.env = Environment( extensions=[PipelineExtension], loader=PackageLoader("pipeline", "templates"), ) def test_no_package(self): template = self.env.from_string("""{% stylesheet "unknow" %}""") self.assertEqual("", template.render()) template = self.env.from_string("""{% javascript "unknow" %}""") self.assertEqual("", template.render()) def test_package_css(self): template = self.env.from_string("""{% stylesheet "screen" %}""") self.assertEqual( '', template.render(), ) @pipeline_settings(PIPELINE_ENABLED=False) def test_package_css_disabled(self): template = self.env.from_string("""{% stylesheet "screen" %}""") self.assertEqual( """ """, # noqa template.render(), ) def test_package_js(self): template = self.env.from_string("""{% javascript "scripts" %}""") self.assertEqual( '', # noqa template.render(), ) def test_package_js_async(self): template = self.env.from_string("""{% javascript "scripts_async" %}""") self.assertEqual( '', # noqa template.render(), ) def test_package_js_defer(self): template = self.env.from_string("""{% javascript "scripts_defer" %}""") self.assertEqual( '', # noqa template.render(), ) def test_package_js_async_defer(self): template = self.env.from_string("""{% javascript "scripts_async_defer" %}""") self.assertEqual( '', # noqa template.render(), ) class DjangoTest(TestCase): def render_template(self, template): return Template(template).render(Context()) def test_compressed_empty(self): rendered = self.render_template( """{% load pipeline %}{% stylesheet "unknow" %}""", ) self.assertEqual("", rendered) def test_compressed_css(self): rendered = self.render_template( """{% load pipeline %}{% stylesheet "screen" %}""", ) self.assertEqual( '', # noqa rendered, ) def test_compressed_css_media(self): rendered = self.render_template( """{% load pipeline %}{% stylesheet "screen_media" %}""", ) self.assertEqual( '', # noqa rendered, ) def test_compressed_css_title(self): rendered = self.render_template( """{% load pipeline %}{% stylesheet "screen_title" %}""", ) self.assertEqual( '', # noqa rendered, ) def test_compressed_js(self): rendered = self.render_template( """{% load pipeline %}{% javascript "scripts" %}""", ) self.assertEqual( '', # noqa rendered, ) def test_compressed_js_async(self): rendered = self.render_template( """{% load pipeline %}{% javascript "scripts_async" %}""", ) self.assertEqual( '', # noqa rendered, ) def test_compressed_js_defer(self): rendered = self.render_template( """{% load pipeline %}{% javascript "scripts_defer" %}""", ) self.assertEqual( '', # noqa rendered, ) def test_compressed_js_async_defer(self): rendered = self.render_template( """{% load pipeline %}{% javascript "scripts_async_defer" %}""", ) self.assertEqual( '', # noqa rendered, ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/test_utils.py0000644000175100017510000000104515061253017021366 0ustar00runnerrunnerimport mimetypes from django.test import TestCase from pipeline.utils import guess_type class UtilTest(TestCase): def test_guess_type(self): self.assertEqual("text/css", guess_type("stylesheet.css")) self.assertEqual("text/coffeescript", guess_type("application.coffee")) self.assertEqual("text/less", guess_type("stylesheet.less")) def test_mimetypes_are_str(self): for ext, mtype in mimetypes.types_map.items(): self.assertIsInstance(ext, str) self.assertIsInstance(mtype, str) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/tests/test_views.py0000644000175100017510000000576115061253017021374 0ustar00runnerrunnerfrom django.contrib.staticfiles.storage import staticfiles_storage from django.core.exceptions import ImproperlyConfigured from django.http import Http404 from django.test import RequestFactory, TestCase from django.test.utils import override_settings from pipeline.collector import default_collector from pipeline.views import serve_static from tests.utils import pipeline_settings @override_settings(DEBUG=True) @pipeline_settings(PIPELINE_COLLECTOR_ENABLED=True, PIPELINE_ENABLED=False) class ServeStaticViewsTest(TestCase): def setUp(self): super().setUp() self.filename = "pipeline/js/first.js" self.storage = staticfiles_storage self.request = RequestFactory().get(f"/static/{self.filename}") default_collector.clear() def tearDown(self): super().tearDown() default_collector.clear() staticfiles_storage._setup() def test_found(self): self._test_found() def test_not_found(self): self._test_not_found("missing-file") @override_settings(DEBUG=False) def test_debug_false(self): with self.assertRaises(ImproperlyConfigured): serve_static(self.request, self.filename) self.assertFalse(self.storage.exists(self.filename)) @override_settings(DEBUG=False) def test_debug_false_and_insecure(self): self._test_found(insecure=True) @pipeline_settings(PIPELINE_ENABLED=True) def test_pipeline_enabled_and_found(self): self._write_content() self._test_found() @pipeline_settings(PIPELINE_ENABLED=True) def test_pipeline_enabled_and_not_found(self): self._test_not_found(self.filename) @pipeline_settings(PIPELINE_COLLECTOR_ENABLED=False) def test_collector_disabled_and_found(self): self._write_content() self._test_found() @pipeline_settings(PIPELINE_COLLECTOR_ENABLED=False) def test_collector_disabled_and_not_found(self): self._test_not_found(self.filename) def _write_content(self, content="abc123"): """Write sample content to the test static file.""" with self.storage.open(self.filename, "w") as f: f.write(content) def _test_found(self, **kwargs): """Test that a file can be found and contains the correct content.""" response = serve_static(self.request, self.filename, **kwargs) self.assertEqual(response.status_code, 200) self.assertTrue(self.storage.exists(self.filename)) if hasattr(response, "streaming_content"): content = b"".join(response.streaming_content) else: content = response.content with self.storage.open(self.filename) as f: self.assertEqual(f.read(), content) def _test_not_found(self, filename): """Test that a file could not be found.""" self.assertFalse(self.storage.exists(filename)) with self.assertRaises(Http404): serve_static(self.request, filename) self.assertFalse(self.storage.exists(filename)) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/urls.py0000644000175100017510000000050615061253017017013 0ustar00runnerrunnerfrom django.contrib import admin from django.urls import path from django.views.generic import TemplateView urlpatterns = [ path("", TemplateView.as_view(template_name="index.html"), name="index"), path("empty/", TemplateView.as_view(template_name="empty.html"), name="empty"), path("admin/", admin.site.urls), ] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/utils.py0000644000175100017510000000112715061253017017166 0ustar00runnerrunnerimport os import django from django.test import override_settings def _(path): # Make sure the path contains only the correct separator return path.replace("/", os.sep).replace("\\", os.sep) class pipeline_settings(override_settings): def __init__(self, **kwargs): if django.VERSION[:2] >= (1, 10): # Django 1.10's override_settings inherits from TestContextDecorator # and its __init__ method calls its superclass' __init__ method too, # so we must do the same. super().__init__() self.options = {"PIPELINE": kwargs} ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757763087.0 django_pipeline-4.1.0/tests/views.py0000644000175100017510000000000015061253017017150 0ustar00runnerrunner