Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csscom
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Taddeüs Kroes
csscom
Commits
01708837
Commit
01708837
authored
12 years ago
by
Taddeüs Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Added command-line option to overwrite original CSS file
parent
cf34ac50
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
csscom.py
+15
-6
15 additions, 6 deletions
csscom.py
with
15 additions
and
6 deletions
csscom.py
+
15
−
6
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
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment