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
bed50c9b
Commit
bed50c9b
authored
Oct 02, 2014
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minified numbers are now rounded to 2 decimal digits
parent
bcf78917
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
stringify.ml
stringify.ml
+5
-2
No files found.
stringify.ml
View file @
bed50c9b
...
@@ -147,13 +147,16 @@ let string_of_stylesheet = cat "\n\n" string_of_statement
...
@@ -147,13 +147,16 @@ let string_of_stylesheet = cat "\n\n" string_of_statement
*)
*)
let
minify_num
n
=
let
minify_num
n
=
(* Round numbers to at most 2 decimal digits *)
let
round2
n
=
floor
(
100
.
*.
n
+.
0
.
5
)
/.
100
.
in
if
float_of_int
(
int_of_float
n
)
=
n
then
if
float_of_int
(
int_of_float
n
)
=
n
then
string_of_int
(
int_of_float
n
)
string_of_int
(
int_of_float
n
)
else
if
n
<
1
.
0
&&
n
>
-
1
.
0
then
else
if
n
<
1
.
0
&&
n
>
-
1
.
0
then
let
s
=
string_of_float
n
in
let
s
=
string_of_float
(
round2
n
)
in
String
.
sub
s
1
(
String
.
length
s
-
1
)
String
.
sub
s
1
(
String
.
length
s
-
1
)
else
else
string_of_float
n
string_of_float
(
round2
n
)
let
rec
minify_expr
=
function
let
rec
minify_expr
=
function
|
Concat
values
->
cat
" "
minify_expr
values
|
Concat
values
->
cat
" "
minify_expr
values
...
...
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