.. _ref-usage:

=====
Usage
=====

Describes how to use Pipedash when it is installed and configured.

Templatetags
============

Pipedash includes a single template tag ``pipedash``,

It is used to output the ``<link>`` and ``<script>``-tags for the
specified resources and packages (as specified in the settings).
The first argument must be the name of the resource group.

When ``settings.DEBUG`` is set to ``True`` the use of these template
tag will result in a separate tag for each resource in a given package (i.e., the
concatenated file will not be used), in order to make local debugging
easy. When ``settings.DEBUG`` is set to ``False`` the opposite is true.
You can override the default behavior by setting ``settings.PIPEDASH_CONCAT``
manually. When set to ``True`` or ``False`` this enables or disables concatenation
respectively.

If you need to change the output of the html tags generated from the pipedash templatetag,
this can be done by lowercasing the output mime type and creating a template in ``pipedash/{{ mime }}.html``

For example, ``text/css`` would become ``pipedash/text/css.html``

Example
-------

If you have specified the packages ``'css:index'`` and ``'js:index'`` you would use the
following code to output them all ::

   {% load pipedash %}
   {% pipedash 'css:index' %}
   {% pipedash 'js:index' %}

Collect static
==============

Pipedash integrates with staticfiles, you just need to add ``pipedash.finders.PipedashFinder``
to your ``STATICFILES_FINDERS``

Then when you run ``collectstatic`` command, your packages will be compiled, compressed and concatenated ::

    $ python manage.py collectstatic
