1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
|
.. _ref-compilers:
=========
Compilers
=========
TypeScript compiler
======================
The TypeScript compiler uses `TypeScript <https://www.typescriptlang.org/>`_
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 <http://jashkenas.github.com/coffeescript/>`_
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 <https://github.com/gkz/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 <http://lesscss.org/>`_
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 <http://sass-lang.com/>`_
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 <http://learnboost.github.com/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 <https://babeljs.io>`_
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 <https://github.com/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 <https://github.com/vbabiy>`_
:Description:
django-pipeline-compass is a compiler for `django-pipeline <https://github.com/jazzband/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 <https://github.com/sonic182>`_
:Description:
libsasscompiler is a compiler for `django-pipeline <https://github.com/jazzband/django-pipeline>`_. Making it really easy to use scss/sass with the super fast libsass library.
:Link:
`https://github.com/sonic182/libsasscompiler`
|