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
d6a89902
Commit
d6a89902
authored
Oct 22, 2010
by
ara818
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add closure compiler
parent
5f0d598b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
compress/conf/settings.py
+3
-0
compress/filters/closure/__init__.py
+39
-0
No files found.
compress/conf/settings.py
View file @
d6a89902
...
...
@@ -20,6 +20,9 @@ COMPRESS_YUI_BINARY = getattr(settings, 'COMPRESS_YUI_BINARY', 'java -jar yuicom
COMPRESS_YUI_CSS_ARGUMENTS
=
getattr
(
settings
,
'COMPRESS_YUI_CSS_ARGUMENTS'
,
''
)
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'
,
''
)
if
COMPRESS_CSS_FILTERS
is
None
:
COMPRESS_CSS_FILTERS
=
[]
...
...
compress/filters/closure/__init__.py
0 → 100644
View file @
d6a89902
import
subprocess
from
compress.conf
import
settings
from
compress.filter_base
import
FilterBase
,
FilterError
class
ClosureCompressorFilter
(
FilterBase
):
def
filter_common
(
self
,
content
,
type_
,
arguments
):
command
=
'
%
s
%
s'
%
(
settings
.
COMPRESS_CLOSURE_BINARY
,
arguments
)
if
self
.
verbose
:
command
+=
' --verbose'
print
command
p
=
subprocess
.
Popen
(
command
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
\
stdin
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
p
.
stdin
.
write
(
content
)
p
.
stdin
.
close
()
filtered_css
=
p
.
stdout
.
read
()
p
.
stdout
.
close
()
err
=
p
.
stderr
.
read
()
p
.
stderr
.
close
()
if
p
.
wait
()
!=
0
:
if
not
err
:
err
=
'Unable to apply Closure Compressor filter'
raise
FilterError
(
err
)
if
self
.
verbose
:
print
err
return
filtered_css
def
filter_js
(
self
,
js
):
return
self
.
filter_common
(
js
,
'js'
,
settings
.
COMPRESS_CLOSURE_JS_ARGUMENTS
)
\ No newline at end of file
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