Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
csscom
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
csscom
Commits
01708837
Commit
01708837
authored
Dec 31, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added command-line option to overwrite original CSS file
parent
cf34ac50
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
csscom.py
csscom.py
+15
-6
No files found.
csscom.py
View file @
01708837
#!/usr/bin/env python
from
argparse
import
ArgumentParser
import
logging
import
sys
from
parse
import
parse_groups
from
generate
import
generate_group
...
...
@@ -56,10 +55,12 @@ def parse_options():
parser
.
add_argument
(
'-o'
,
'--output'
,
metavar
=
'FILE'
,
help
=
'filename for compressed output (default is '
'stdout)'
)
parser
.
add_argument
(
'-ow'
,
'--overwrite'
,
action
=
'store_true'
,
help
=
'use the first CSS file as output file'
)
parser
.
add_argument
(
'-v'
,
'--verbose'
,
help
=
'show which compressions are performed'
)
parser
.
add_argument
(
'-d'
,
'--debug'
,
help
=
'show debug statements'
)
parser
.
add_argument
(
'--logfile'
,
metavar
=
'FILE'
,
default
=
sys
.
stderr
,
parser
.
add_argument
(
'--logfile'
,
metavar
=
'FILE'
,
help
=
'file to write verbose/debug statements to '
'(defaults to stderr)'
)
args
=
parser
.
parse_args
()
...
...
@@ -84,11 +85,19 @@ def _content(filename):
if
__name__
==
'__main__'
:
args
=
parse_options
()
options
=
dict
(
args
.
_get_kwargs
())
files
=
options
.
pop
(
'files'
)
del
options
[
'no_compression'
]
spaces
=
options
.
pop
(
'spaces'
)
options
[
'tab'
]
=
'
\
t
'
if
spaces
is
None
else
spaces
*
' '
output_file
=
options
.
pop
(
'output'
)
del
options
[
'no_compression'
]
outfile
=
options
.
pop
(
'output'
)
if
options
.
pop
(
'overwrite'
):
outfile
=
files
[
0
]
log_level
=
logging
.
WARNING
if
options
.
pop
(
'verbose'
):
...
...
@@ -105,8 +114,8 @@ if __name__ == '__main__':
css
=
'
\
n
'
.
join
(
_content
(
filename
)
for
filename
in
files
)
compressed
=
compress_css
(
css
,
**
options
)
if
out
put_
file
:
open
(
out
put_
file
,
'w'
).
write
(
compressed
)
if
outfile
:
open
(
outfile
,
'w'
).
write
(
compressed
)
else
:
print
compressed
,
except
IOError
as
e
:
...
...
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