djblets.pipeline.settings¶
Utilities and constants for configuring Pipeline.
Note
This is safe to import from a project’s settings.py
without
side effects (for instance, it will not load any Django models or apps).
New in version 2.1.
- DEFAULT_PIPELINE_COMPILERS = ['djblets.pipeline.compilers.es6.ES6Compiler', 'djblets.pipeline.compilers.less.LessCompiler']¶
Default list of compilers used by Djblets.
- build_pipeline_settings(pipeline_enabled, node_modules_path, static_root, javascript_bundles=[], stylesheet_bundles=[], compilers=['djblets.pipeline.compilers.es6.ES6Compiler', 'djblets.pipeline.compilers.less.LessCompiler'], babel_extra_plugins=[], babel_extra_args=[], less_extra_args=[], validate_paths=True)¶
Build a standard set of Pipeline settings.
This can be used to create a
PIPELINE
settings dictionary in asettings.py
file based on the standard Djblets Pipeline settings, which makes use of Babel, LessCSS, and UglifyJS, along with a preset list of plugins.The following base set of Babel plugins are used:
The following LessCSS plugin is used:
This will also set the value of
node_modules_path
in theNODE_PATH
environment variable.- Parameters:
pipeline_enabled (
bool
) –Whether Pipelining of static media should be enabled.
This must be provided by a caller. It’s recommended to enable this if
DEBUG
isFalse
(or, better, use another variable indicating a production vs. development environment).node_modules_path (
unicode
) – The path to the loalnode_modules
directory for the project.static_root (
unicode
) – The value of thesettings.STATIC_ROOT
. This must be provided explicitly, sincesettings.py
is likely the module calling this.javascript_bundles (
list
ofdict
, optional) – A list of JavaScript bundle packages for Pipeline to handle.stylesheet_bundles (
list
ofdict
, optional) – A list of stylesheet bundle packages for Pipeline to handle.compilers (
list
ofunicode
, optional) – A list of compilers to use for static media.babel_extra_plugins (
list
ofunicode
, optional) – A list of additional Babel plugins to enable.babel_extra_args (
list
ofunicode
, optional) – Extra command line arguments to pass to Babel.less_extra_args (
list
ofunicode
, optional) – Extra command line arguments to pass to LessCSS.validate_paths (
bool
, optional) –Whether to validate any expected paths to binary files.
It’s recommended to set this based on
DEBUG
, or another variable indicating a production vs. development environment.If the
DJBLETS_SKIP_PIPELINE_VALIDATION
environment variable is set to1
, then this will be forced toFalse
. This is primarily used for packaging building.