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
614560b3
Commit
614560b3
authored
Dec 31, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaces 'compress_blocks' with 'combine_blocks', which is more fitting
parent
aff651f9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
compress.py
compress.py
+1
-1
csscom.py
csscom.py
+5
-5
generate.py
generate.py
+3
-3
tests/test_compress.py
tests/test_compress.py
+2
-2
No files found.
compress.py
View file @
614560b3
def
com
press
_blocks
(
blocks
):
def
com
bine
_blocks
(
blocks
):
# Map of property stringification to list of containing blocks
#property_locations = {}
...
...
csscom.py
View file @
614560b3
...
...
@@ -5,11 +5,11 @@ from parse import parse_groups
from
generate
import
generate_group
def
compress_css
(
css
,
com
press
_blocks
=
True
,
compress_whitespace
=
True
,
def
compress_css
(
css
,
com
bine
_blocks
=
True
,
compress_whitespace
=
True
,
compress_color
=
True
,
compress_font
=
True
,
compress_dimension
=
True
,
sort_properties
=
True
):
groups
=
parse_groups
(
css
)
options
=
dict
(
com
press_blocks
=
compress
_blocks
,
options
=
dict
(
com
bine_blocks
=
combine
_blocks
,
compress_whitespace
=
compress_whitespace
,
compress_color
=
compress_color
,
compress_font
=
compress_font
,
...
...
@@ -35,7 +35,7 @@ def parse_options():
parser
.
add_argument
(
'-cd'
,
'--compress-dimension'
,
action
=
'store_true'
,
help
=
'replace separate margin/padding statements with '
'shortcut statements where possible'
)
parser
.
add_argument
(
'-cb'
,
'--com
press
-blocks'
,
action
=
'store_true'
,
parser
.
add_argument
(
'-cb'
,
'--com
bine
-blocks'
,
action
=
'store_true'
,
help
=
'combine or split blocks into blocks with '
'comma-separated selectors if it results in less '
'css code'
)
...
...
@@ -50,9 +50,9 @@ def parse_options():
# Enable all compression options if none are explicitely enabled
if
not
any
([
args
.
compress_whitespace
,
args
.
compress_color
,
args
.
compress_font
,
args
.
compress_dimension
,
args
.
com
press
_blocks
])
and
not
args
.
no_compression
:
args
.
com
bine
_blocks
])
and
not
args
.
no_compression
:
args
.
compress_whitespace
=
args
.
compress_color
=
args
.
compress_font
=
\
args
.
compress_dimension
=
args
.
com
press
_blocks
=
True
args
.
compress_dimension
=
args
.
com
bine
_blocks
=
True
return
args
...
...
generate.py
View file @
614560b3
...
...
@@ -59,14 +59,14 @@ def generate_block(selectors, properties, compress_whitespace=False,
compress_whitespace
=
compress_whitespace
,
tab
=
tab
)
def
generate_group
(
selectors
,
blocks
,
com
press
_blocks
=
True
,
def
generate_group
(
selectors
,
blocks
,
com
bine
_blocks
=
True
,
compress_whitespace
=
True
,
compress_color
=
True
,
compress_font
=
True
,
compress_dimension
=
True
,
sort_properties
=
True
,
tab
=
'
\
t
'
):
compressed_blocks
=
[]
if
com
press
_blocks
:
blocks
=
compress
.
com
press
_blocks
(
blocks
)
if
com
bine
_blocks
:
blocks
=
compress
.
com
bine
_blocks
(
blocks
)
for
block_selectors
,
properties
in
blocks
:
if
compress_color
:
...
...
tests/test_compress.py
View file @
614560b3
from
unittest
import
TestCase
from
compress
import
com
press
_blocks
,
compress_color
,
compress_font
,
\
from
compress
import
com
bine
_blocks
,
compress_color
,
compress_font
,
\
compress_dimension
class
TestProperties
(
TestCase
):
def
test_com
press
_blocks
(
self
):
def
test_com
bine
_blocks
(
self
):
pass
def
test_compress_color
(
self
):
...
...
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