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
596e89fd
Commit
596e89fd
authored
Dec 31, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Command-line now supports stdin input in addition to files
parent
ec5e5cae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
csscom.py
csscom.py
+13
-3
No files found.
csscom.py
View file @
596e89fd
#!/usr/bin/env python
from
argparse
import
ArgumentParser
import
logging
import
sys
from
parse
import
parse_groups
from
generate
import
generate_group
...
...
@@ -28,8 +29,9 @@ def parse_options():
'If none of the compression options below (those starting with '
'"-c") are specified, all are enabled by default. If any are '
'specified, the others are not enabled.'
)
parser
.
add_argument
(
'files'
,
metavar
=
'FILE'
,
nargs
=
'+'
,
help
=
'CSS files to compress'
)
parser
.
add_argument
(
'files'
,
metavar
=
'FILE'
,
nargs
=
'*'
,
help
=
'CSS files to compress (CSS is read from stdin '
'if no files are specified)'
)
parser
.
add_argument
(
'-cw'
,
'--compress-whitespace'
,
action
=
'store_true'
,
help
=
'omit unnecessary whitespaces and semicolons'
)
parser
.
add_argument
(
'-cc'
,
'--compress-color'
,
action
=
'store_true'
,
...
...
@@ -97,6 +99,10 @@ if __name__ == '__main__':
outfile
=
options
.
pop
(
'output'
)
if
options
.
pop
(
'overwrite'
):
if
not
files
:
print
'error: cannot use --overwrite option wihthout filenames'
sys
.
exit
(
1
)
outfile
=
files
[
0
]
log_level
=
logging
.
WARNING
...
...
@@ -112,7 +118,11 @@ if __name__ == '__main__':
format
=
'%(filename)s, line %(lineno)s: %(levelname)s: %(message)s'
)
try
:
css
=
'
\
n
'
.
join
(
_content
(
filename
)
for
filename
in
files
)
if
files
:
css
=
'
\
n
'
.
join
(
_content
(
filename
)
for
filename
in
files
)
else
:
css
=
sys
.
stdin
.
read
()
compressed
=
compress_css
(
css
,
**
options
)
if
outfile
:
...
...
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