Skip to content

Commit cb91756

Browse files
author
Andrey Fedoseev
committed
Polish the 6to5 integration
- fix tests - rename compiler module and class - update README, CHANGES, AUTHORS, and setup.py - update travis config to install 6to5 - adopt the code to new format of settings and template tags
1 parent ce5cded commit cb91756

File tree

12 files changed

+52
-70
lines changed

12 files changed

+52
-70
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ matrix:
1717
before_install:
1818
- npm install -g coffee-script
1919
- npm install -g less@1.7.4
20+
- npm install -g 6to5@3.5.3
2021
- gem install sass --version 3.3.14
2122
- gem install compass --version 1.0.1
2223
install:

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ Contributors
55

66
Sergey Fedoseev [https://github.com/sir-sigurd]
77
Alexey Kuleshevich [https://github.com/lehins]
8+
Andrey Dresvyannikov [https://github.com/sepulchered]

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Dev
1414
* ``LESS_EXECUTABLE``
1515
- ``-C`` (``--no-cache``) flag is removed from SASS/SCSS compilers
1616
- Add ``STATIC_PRECOMPILER_LIST_FILES`` setting
17+
- Add `6to5 <https://6to5.org/>`_ compiler
1718

1819
0.8
1920
===

README.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ General settings
101101

102102
STATIC_PRECOMPILER_COMPILERS = (
103103
'static_precompiler.compilers.CoffeeScript',
104+
'static_precompiler.compilers.ES6To5',
104105
'static_precompiler.compilers.SASS',
105106
'static_precompiler.compilers.SCSS',
106107
'static_precompiler.compilers.LESS',
@@ -160,6 +161,19 @@ Example::
160161
)
161162

162163

164+
6to5
165+
----
166+
167+
``executable``
168+
Path to 6to5 compiler executable. Default: ``"6to5"``.
169+
170+
Example::
171+
172+
STATIC_PRECOMPILER_COMPILERS = (
173+
('static_precompiler.compilers.ES6To5', {"executable": "/usr/bin/6to5"}),
174+
)
175+
176+
163177
SASS / SCSS
164178
-----------
165179

provision.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ fi
1717

1818
sudo npm install -g coffee-script@1.7.1
1919
sudo npm install -g less@1.7.4
20+
sudo npm install -g 6to5@3.5.3
2021

2122

2223
##############

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def read(fname):
4141
author_email="andrey.fedoseev@gmail.com",
4242
url="https://github.com/andreyfedoseev/django-static-precompiler",
4343
description="Django template tags to compile all kinds of static files "
44-
"(SASS, LESS, CoffeeScript).",
44+
"(SASS, LESS, CoffeeScript, ECMAScript 6to5).",
4545
long_description="\n\n".join([README, CHANGES]),
4646
classifiers=[
4747
'Development Status :: 4 - Beta',
@@ -53,7 +53,7 @@ def read(fname):
5353
'Programming Language :: Python :: 3',
5454
'Topic :: Internet :: WWW/HTTP',
5555
],
56-
keywords=["sass", "scss", "less", "css", "coffeescript", "javascript"],
56+
keywords=["sass", "scss", "less", "css", "coffeescript", "javascript", "6to5"],
5757
tests_require=[
5858
"pytest",
5959
"pytest-django",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding: utf-8
22
from static_precompiler.compilers.coffeescript import CoffeeScript
3-
from static_precompiler.compilers.es6 import ES6Script
3+
from static_precompiler.compilers.es6to5 import ES6To5
44
from static_precompiler.compilers.scss import SASS, SCSS
55
from static_precompiler.compilers.less import LESS

static_precompiler/compilers/es6.py renamed to static_precompiler/compilers/es6to5.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
from static_precompiler.exceptions import StaticCompilationError
22
from static_precompiler.compilers.base import BaseCompiler
3-
from static_precompiler.settings import ES6_EXECUTABLE
43
from static_precompiler.utils import run_command
54

65

7-
class ES6Script(BaseCompiler):
6+
class ES6To5(BaseCompiler):
7+
88
name = "es6"
99
input_extension = "es6"
1010
output_extension = "js"
1111

12+
def __init__(self, executable="6to5"):
13+
self.executable = executable
14+
super(ES6To5, self).__init__()
15+
1216
def compile_file(self, source_path):
1317
return self.compile_source(self.get_source(source_path))
1418

1519
def compile_source(self, source):
1620
args = [
17-
ES6_EXECUTABLE
21+
self.executable
1822
]
1923
out, errors = run_command(args, source)
2024
if errors:

static_precompiler/settings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
COMPILERS = getattr(settings, "STATIC_PRECOMPILER_COMPILERS", (
1515
"static_precompiler.compilers.CoffeeScript",
16-
"static_precompiler.compilers.ES6Script",
16+
"static_precompiler.compilers.ES6To5",
1717
"static_precompiler.compilers.SASS",
1818
"static_precompiler.compilers.SCSS",
1919
"static_precompiler.compilers.LESS",
@@ -55,7 +55,6 @@
5555

5656

5757
COFFEESCRIPT_EXECUTABLE = getattr(settings, "COFFEESCRIPT_EXECUTABLE", "coffee")
58-
ES6_EXECUTABLE = getattr(settings, "ES6_EXECUTABLE", "6to5")
5958
SCSS_EXECUTABLE = getattr(settings, "SCSS_EXECUTABLE", "sass")
6059
SCSS_USE_COMPASS = getattr(settings, "SCSS_USE_COMPASS", False)
6160
LESS_EXECUTABLE = getattr(settings, "LESS_EXECUTABLE", "lessc")

static_precompiler/templatetags/es6.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)