<commit_before>.. _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 ``<script>`` for js package or ``<link>`` for css package.

Defaults to ``None``.

``extra_context``
.................

**Optional**

Is a dictionary of values to add to the template context,
when generating the HTML for the HTML-tags with the templatetags.

For CSS, if you do not specify ``extra_context``/``media``, the default media in
the ``<link>`` output will be ``media="all"``.

For JS, the default templates support the ``async`` and ``defer`` tag attributes which are controlled via ``extra_context``: ::

  'extra_context': {
      'async': True,
  },

``manifest``
............

**Optional**

Indicate if you want this group to appear in your cache manifest.

Defaults to ``True``.


Other settings
--------------

``PIPELINE_ENABLED``
....................

``True`` if assets should be compressed, ``False`` if not.

Defaults to ``not settings.DEBUG``.

``CSS_COMPRESSOR``
............................

Compressor class to be applied to CSS files.

If empty or ``None``, CSS files won't be compressed.

Defaults to ``'pipeline.compressors.yuglify.YuglifyCompressor'``.

``JS_COMPRESSOR``
...........................

Compressor class to be applied to JavaScript files.

If empty or ``None``, JavaScript files won't be compressed.

Defaults to ``'pipeline.compressors.yuglify.YuglifyCompressor'``

.. note::<commit_msg>add doc for deactivate collector in develop<commit_after>.. _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 ``<script>`` for js package or ``<link>`` for css package.

Defaults to ``None``.

``extra_context``
.................

**Optional**

Is a dictionary of values to add to the template context,
when generating the HTML for the HTML-tags with the templatetags.

For CSS, if you do not specify ``extra_context``/``media``, the default media in
the ``<link>`` output will be ``media="all"``.

For JS, the default templates support the ``async`` and ``defer`` tag attributes which are controlled via ``extra_context``: ::

  'extra_context': {
      'async': True,
  },

``manifest``
............

**Optional**

Indicate if you want this group to appear in your cache manifest.

Defaults to ``True``.


Other settings
--------------

``PIPELINE_ENABLED``
....................

``True`` if assets should be compressed, ``False`` if not.

Defaults to ``not settings.DEBUG``.

``PIPELINE_COLLECTOR_ENABLED``
....................

``True`` if assets should be collected in develop , ``False`` if not.

Defaults to ``True``

.. note::

  this only work when PIPELINE_ENABLED is False.

``CSS_COMPRESSOR``
............................

Compressor class to be applied to CSS files.

If empty or ``None``, CSS files won't be compressed.

Defaults to ``'pipeline.compressors.yuglify.YuglifyCompressor'``.

``JS_COMPRESSOR``
...........................

Compressor class to be applied to JavaScript files.

If empty or ``None``, JavaScript files won't be compressed.

Defaults to ``'pipeline.compressors.yuglify.YuglifyCompressor'``

.. note::
{'fraction_non_alphanumeric': 0.18359320129231635, 'fraction_numerical': 0.0005618766680713583, 'mean_word_length': 2.016949152542373, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1166598', 'n_tokens_mistral': 2054, 'n_tokens_neox': 1984, 'n_words': 658}