Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mincss
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
mincss
Commits
2406d894
Commit
2406d894
authored
Oct 01, 2014
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved shorthand folding when component expressions are !important
parent
d36f52bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
7 deletions
+25
-7
font.ml
font.ml
+13
-0
shorthand.ml
shorthand.ml
+12
-7
No files found.
font.ml
0 → 100644
View file @
2406d894
open
Types
let
rec
shorten
=
function
|
Ident
"normal"
->
Number
(
400
.
0
,
None
)
|
Ident
"bold"
->
Number
(
700
.
0
,
None
)
|
v
->
v
let
transform
=
function
|
Declaration
(
"font-weight"
,
value
,
imp
)
->
Declaration
(
"font-weight"
,
shorten
value
,
imp
)
|
v
->
v
let
compress
=
Util
.
transform_stylesheet
transform
shorthand.ml
View file @
2406d894
...
...
@@ -28,13 +28,17 @@ let rec decls_mem name = function
(* find the value of the last declaration of some property (since the earlier
* values are overridden), unless an earlier !important value was found *)
let
decls_find
name
decls
=
let
rec
wrap
known
=
function
|
[]
->
known
|
(
nm
,
value
,
true
)
::
_
when
nm
=
name
->
Some
value
|
(
nm
,
value
,
false
)
::
tl
when
nm
=
name
->
wrap
(
Some
value
)
tl
|
_
::
tl
->
wrap
known
tl
let
rec
wrap
known
must_be_imp
=
function
|
[]
->
known
|
(
nm
,
value
,
false
)
::
tl
when
nm
=
name
&&
not
must_be_imp
->
wrap
(
Some
value
)
false
tl
|
(
nm
,
value
,
true
)
::
tl
when
nm
=
name
->
wrap
(
Some
value
)
true
tl
|
_
::
tl
->
wrap
known
must_be_imp
tl
in
match
wrap
None
decls
with
match
wrap
None
false
decls
with
|
None
->
raise
Not_found
|
Some
value
->
value
...
...
@@ -261,7 +265,8 @@ let make_shorthands decls =
let
keep_prop
=
function
|
(
"line-height"
,
_
,
_
)
->
not
(
decls_mem
"font"
shorthands
)
|
(
name
,
_
,
_
)
->
|
(
name
,
_
,
imp
)
->
imp
||
not
(
Str
.
string_match
pattern
name
0
)
||
let
base
=
Str
.
matched_group
1
name
in
let
sub
=
Str
.
matched_group
2
name
in
...
...
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