Skip to content

Commit 6699a27

Browse files
committed
Added join compiler
1 parent ee07532 commit 6699a27

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

django_compressor_closure_api_compile_filter/compiler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ def minify(text):
3030
response = requests.post(URL, data).json()
3131

3232
return response['compiledCode']
33+
34+
35+
def join(text):
36+
return text

django_compressor_closure_api_compile_filter/filters.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44
class ClosureAPICompileFilter(CallbackOutputFilter):
55
dependencies = ['requests']
66
callback = 'django_compressor_closure_api_compile_filter.compiler.minify'
7+
8+
9+
class JoinAPICompileFilter(CallbackOutputFilter):
10+
callback = 'django_compressor_closure_api_compile_filter.compiler.join'

tests.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
'''
1616

1717

18-
class TestCompiler(unittest.TestCase):
18+
class TestClosureApiCompiler(unittest.TestCase):
1919

20-
def test_minify(self):
20+
def test_minify_bad(self):
2121
with self.assertRaises(compiler.ParseError) as cm:
2222
compiler.minify(ERROR_JS_CODE)
2323

@@ -28,3 +28,10 @@ def test_minify(self):
2828
def test_minify_good(self):
2929
minify_code = compiler.minify(GOOD_JS_CODE)
3030
self.assertTrue(minify_code, 'function hello(){console.log()};')
31+
32+
33+
class TestJoinApiCompiler(unittest.TestCase):
34+
35+
def test_join(self):
36+
code = compiler.join(GOOD_JS_CODE)
37+
self.assertTrue(code, GOOD_JS_CODE)

0 commit comments

Comments
 (0)