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
9e2db91b
Commit
9e2db91b
authored
Apr 17, 2011
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add uglifyjs filter
parent
b1ec9cf0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
compress/conf/settings.py
+3
-0
compress/filters/uglifyjs/__init__.py
+34
-0
No files found.
compress/conf/settings.py
View file @
9e2db91b
...
...
@@ -27,6 +27,9 @@ COMPRESS_YUI_JS_ARGUMENTS = getattr(settings, 'COMPRESS_YUI_JS_ARGUMENTS', '')
COMPRESS_CLOSURE_BINARY
=
getattr
(
settings
,
'COMPRESS_CLOSURE_BINARY'
,
'java -jar compiler.jar'
)
COMPRESS_CLOSURE_JS_ARGUMENTS
=
getattr
(
settings
,
'COMPRESS_CLOSURE_JS_ARGUMENTS'
,
''
)
COMPRESS_UGLIFYJS_BINARY
=
getattr
(
settings
,
'COMPRESS_UGLIFYJS_BINARY'
,
'/usr/local/bin/uglifyjs'
)
COMPRESS_UGLIFYJS_ARGUMENTS
=
getattr
(
settings
,
'COMPRESS_UGLIFYJS_ARGUMENTS'
,
'-nc'
)
if
COMPRESS_CSS_FILTERS
is
None
:
COMPRESS_CSS_FILTERS
=
[]
...
...
compress/filters/uglifyjs/__init__.py
0 → 100644
View file @
9e2db91b
import
subprocess
from
compress.conf
import
settings
from
compress.filter_base
import
FilterBase
,
FilterError
class
UglifyJSCompressorFilter
(
FilterBase
):
def
filter_js
(
self
,
js
):
command
=
'
%
s
%
s'
%
(
settings
.
COMPRESS_UGLIFYJS_BINARY
,
settings
.
COMPRESS_UGLIFYJS_ARGUMENTS
)
if
self
.
verbose
:
command
+=
' --verbose'
p
=
subprocess
.
Popen
(
command
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
\
stdin
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
p
.
stdin
.
write
(
js
)
p
.
stdin
.
close
()
filtered_js
=
p
.
stdout
.
read
()
p
.
stdout
.
close
()
err
=
p
.
stderr
.
read
()
p
.
stderr
.
close
()
if
p
.
wait
()
!=
0
:
if
not
err
:
err
=
'Unable to apply UglifyJS Compressor filter'
raise
FilterError
(
err
)
if
self
.
verbose
:
print
err
return
filtered_js
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