Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-pipeline
Commits
57593e75
Commit
57593e75
authored
Feb 03, 2015
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ES6 support via 6to5.
parent
4751a12a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
0 deletions
+53
-0
docs/compilers.rst
+28
-0
pipeline/compilers/es6.py
+22
-0
pipeline/conf.py
+3
-0
No files found.
docs/compilers.rst
View file @
57593e75
...
...
@@ -144,6 +144,34 @@ To use it add this to your ``PIPELINE_COMPILERS`` ::
Defaults to ``''``.
ES6 compiler
============
The ES6 compiler uses `6to5 <https://6to5.org>`_
to convert ES6+ code into vanilla ES5.
To use it add this to your ``PIPELINE_COMPILERS`` ::
PIPELINE_COMPILERS = (
'pipeline.compilers.es6.ES6Compiler',
)
``PIPELINE_6TO5_BINARY``
--------------------------
Command line to execute for 6to5 program.
You will most likely change this to the location of 6to5 on your system.
Defaults to ``'/usr/bin/env 6to5'``.
``PIPELINE_6TO5_ARGUMENTS``
-----------------------------
Additional arguments to use when 6to5 is called.
Defaults to ``''``.
Write your own compiler class
=============================
...
...
pipeline/compilers/es6.py
0 → 100644
View file @
57593e75
from
__future__
import
unicode_literals
from
pipeline.conf
import
settings
from
pipeline.compilers
import
SubProcessCompiler
class
ES6Compiler
(
SubProcessCompiler
):
output_extension
=
'js'
def
match_file
(
self
,
path
):
return
path
.
endswith
(
'.es6'
)
def
compile_file
(
self
,
infile
,
outfile
,
outdated
=
False
,
force
=
False
):
if
not
outdated
and
not
force
:
return
# File doesn't need to be recompiled
command
=
"
%
s
%
s
%
s -o
%
s"
%
(
settings
.
PIPELINE_6TO5_BINARY
,
settings
.
PIPELINE_6TO5_ARGUMENTS
,
infile
,
outfile
)
return
self
.
execute_command
(
command
)
pipeline/conf.py
View file @
57593e75
...
...
@@ -48,6 +48,9 @@ DEFAULTS = {
'PIPELINE_COFFEE_SCRIPT_BINARY'
:
'/usr/bin/env coffee'
,
'PIPELINE_COFFEE_SCRIPT_ARGUMENTS'
:
''
,
'PIPELINE_6TO5_BINARY'
:
'/usr/bin/env 6to5'
,
'PIPELINE_6TO5_ARGUMENTS'
:
''
,
'PIPELINE_LIVE_SCRIPT_BINARY'
:
'/usr/bin/env lsc'
,
'PIPELINE_LIVE_SCRIPT_ARGUMENTS'
:
''
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment