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
3c2f770e
Commit
3c2f770e
authored
Dec 31, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a command-line option to customize indenting
parent
efa34f14
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
csscom.py
csscom.py
+8
-2
No files found.
csscom.py
View file @
3c2f770e
...
...
@@ -7,14 +7,15 @@ from generate import generate_group
def
compress_css
(
css
,
combine_blocks
=
True
,
compress_whitespace
=
True
,
compress_color
=
True
,
compress_font
=
True
,
compress_dimension
=
True
,
sort_properties
=
True
):
compress_dimension
=
True
,
sort_properties
=
True
,
tab
=
'
\
t
'
):
groups
=
parse_groups
(
css
)
options
=
dict
(
combine_blocks
=
combine_blocks
,
compress_whitespace
=
compress_whitespace
,
compress_color
=
compress_color
,
compress_font
=
compress_font
,
compress_dimension
=
compress_dimension
,
sort_properties
=
sort_properties
)
sort_properties
=
sort_properties
,
tab
=
tab
)
compressed_groups
=
[
generate_group
(
selectors
,
blocks
,
**
options
)
for
selectors
,
blocks
in
groups
]
newlines
=
''
if
compress_whitespace
else
'
\
n
\
n
'
...
...
@@ -46,6 +47,9 @@ def parse_options():
help
=
'don
\
'
t apply any compression, just generate CSS'
)
parser
.
add_argument
(
'-ns'
,
'--no-sort'
,
action
=
'store_false'
,
dest
=
'sort_properties'
,
help
=
'sort property names'
)
parser
.
add_argument
(
'-s'
,
'--spaces'
,
type
=
int
,
metavar
=
'NUMBER'
,
help
=
'number of spaces to use for indenting (indent '
'defaults to a single tab [
\
\
t])'
)
parser
.
add_argument
(
'-o'
,
'--output'
,
metavar
=
'FILE'
,
help
=
'filename for compressed output (default is '
'stdout)'
)
...
...
@@ -72,6 +76,8 @@ if __name__ == '__main__':
args
=
parse_options
()
options
=
dict
(
args
.
_get_kwargs
())
files
=
options
.
pop
(
'files'
)
spaces
=
options
.
pop
(
'spaces'
)
options
[
'tab'
]
=
'
\
t
'
if
spaces
is
None
else
spaces
*
' '
output_file
=
options
.
pop
(
'output'
)
del
options
[
'no_compression'
]
...
...
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