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
04843037
Commit
04843037
authored
Dec 31, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compression methods now alter their argument instead of making a copy
parent
2737089c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
6 deletions
+27
-6
compress.py
compress.py
+24
-3
generate.py
generate.py
+3
-3
No files found.
compress.py
View file @
04843037
from
color
import
color_shortcut
def
combine_blocks
(
blocks
):
# Map of property stringification to list of containing blocks
#property_locations = {}
...
...
@@ -5,13 +8,31 @@ def combine_blocks(blocks):
return
blocks
def
_filter_property
(
basename
,
properties
):
prefix
=
basename
+
'-'
filtered
=
[]
for
prop
in
list
(
properties
):
name
,
value
=
prop
if
name
==
basename
or
name
[:
len
(
prefix
)]
==
prefix
:
filtered
.
append
(
properties
.
remove
(
prop
))
return
filtered
def
compress_color
(
properties
):
return
properties
for
i
,
(
name
,
value
)
in
enumerate
(
properties
):
if
name
in
(
'color'
,
'background-color'
,
'border-color'
):
properties
[
i
]
=
(
name
,
color_shortcut
(
value
))
def
compress_font
(
properties
):
return
properties
#fonts = _filter_property('font', properties)
pass
def
compress_dimension
(
properties
):
return
properties
#margins = _filter_property('margin', properties)
#paddings = _filter_property('padding', properties)
pass
generate.py
View file @
04843037
...
...
@@ -70,13 +70,13 @@ def generate_group(selectors, blocks, combine_blocks=True,
for
block_selectors
,
properties
in
blocks
:
if
compress_color
:
properties
=
compress
.
compress_color
(
properties
)
compress
.
compress_color
(
properties
)
if
compress_font
:
properties
=
compress
.
compress_font
(
properties
)
compress
.
compress_font
(
properties
)
if
compress_dimension
:
properties
=
compress
.
compress_dimension
(
properties
)
compress
.
compress_dimension
(
properties
)
compressed_blocks
.
append
(
generate_block
(
block_selectors
,
properties
,
compress_whitespace
=
compress_whitespace
,
...
...
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