Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mkcss
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
projects
mkcss
Commits
c089d735
Verified
Commit
c089d735
authored
1 year ago
by
theMackabu
Browse files
Options
Downloads
Patches
Plain Diff
support rounded classes
parent
f5e7e961
Branches
master
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
Cargo.lock
+1
-1
1 addition, 1 deletion
Cargo.lock
Cargo.toml
+1
-1
1 addition, 1 deletion
Cargo.toml
Maidfile.toml
+1
-1
1 addition, 1 deletion
Maidfile.toml
src/css.rs
+4
-1
4 additions, 1 deletion
src/css.rs
src/util.rs
+9
-2
9 additions, 2 deletions
src/util.rs
with
16 additions
and
6 deletions
Cargo.lock
+
1
−
1
View file @
c089d735
...
...
@@ -481,7 +481,7 @@ dependencies = [
[[package]]
name = "mkcss"
version = "0.
1.6
"
version = "0.
2.0
"
dependencies = [
"clap",
"clap-verbosity-flag",
...
...
This diff is collapsed.
Click to expand it.
Cargo.toml
+
1
−
1
View file @
c089d735
[package]
name
=
"mkcss"
version
=
"0.
1.7
"
version
=
"0.
2.0
"
edition
=
"2021"
license
=
"MIT"
repository
=
"https://github.com/exact-rs/mkcss"
...
...
This diff is collapsed.
Click to expand it.
Maidfile.toml
+
1
−
1
View file @
c089d735
...
...
@@ -2,7 +2,7 @@ import = ["util/convert.toml"]
[project]
name
=
"mkcss"
version
=
"0.
1.7
"
version
=
"0.
2.0
"
[tasks.build]
info
=
"Build binaries"
...
...
This diff is collapsed.
Click to expand it.
src/css.rs
+
4
−
1
View file @
c089d735
...
...
@@ -43,16 +43,19 @@ pub fn create_stylesheet(classes: Vec<&String>, add_reset: bool) -> String {
}
"fg"
=>
css_content
.push_str
(
&
format!
(
".{} {{ color: #{} !important }}
\n
"
,
class
,
parts
.get
(
1
)
.unwrap_or
(
&
""
))),
"bg"
=>
css_content
.push_str
(
&
format!
(
".{} {{ background-color: #{} !important }}
\n
"
,
class
,
parts
.get
(
1
)
.unwrap_or
(
&
""
))),
"bc"
=>
css_content
.push_str
(
&
format!
(
".{} {{ border-color: #{} !important }}
\n
"
,
class
,
parts
.get
(
1
)
.unwrap_or
(
&
""
))),
_
=>
{
let
property_value
=
parts
.get
(
if
class
.starts_with
(
"-"
)
{
2
}
else
{
1
})
.map
(|
&
s
|
if
class
.starts_with
(
"-"
)
{
format!
(
"-{}"
,
s
)
}
else
{
s
.to_string
()
})
.unwrap_or_else
(
String
::
new
);
if
let
Some
(
&
(
_
,
property
))
=
util
::
MARGIN
_STYLES
.iter
()
.find
(|(
prop_name
,
_
)|
prop_name
==
&
name
)
{
if
let
Some
(
&
(
_
,
property
))
=
util
::
CONTROL
_STYLES
.iter
()
.find
(|(
prop_name
,
_
)|
prop_name
==
&
name
)
{
let
sign
=
if
name
.starts_with
(
"-"
)
{
"-"
}
else
{
""
};
let
declarations
:
Vec
<
String
>
=
property
.split_whitespace
()
.map
(|
p
|
format!
(
"{}: {}{}px !important"
,
p
,
sign
,
property_value
))
.collect
();
css_content
.push_str
(
&
format!
(
".{} {{ {} }}
\n
"
,
class
,
declarations
.join
(
"; "
)));
}
else
if
let
Some
(
&
(
_
,
value
))
=
util
::
STYLES
.iter
()
.find
(|(
key
,
_
)|
key
==
*&
class
)
{
css_content
.push_str
(
&
format!
(
".{} {{ {} }}
\n
"
,
class
,
value
));
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/util.rs
+
9
−
2
View file @
c089d735
...
...
@@ -212,11 +212,11 @@ pub const STYLES: [(&str, &str); 273] = [
(
"rounded-bl-2xl"
,
"border-bottom-left-radius: 1rem"
),
(
"rounded-bl-3xl"
,
"border-bottom-left-radius: 1.5rem"
),
(
"rounded-bl-full"
,
"border-bottom-left-radius: 9999px"
),
(
"border"
,
"border-style: solid; border-width: 1px"
),
(
"border-0"
,
"border-width: 0px"
),
(
"border-2"
,
"border-width: 2px"
),
(
"border-4"
,
"border-width: 4px"
),
(
"border-8"
,
"border-width: 8px"
),
(
"border"
,
"border-width: 1px"
),
(
"border-x-0"
,
"border-left-width: 0px"
),
(
"border-right-width:"
,
"0px"
),
(
"border-x-2"
,
"border-left-width: 2px"
),
...
...
@@ -278,7 +278,7 @@ pub const STYLES: [(&str, &str); 273] = [
(
"font-mono"
,
MONO
),
];
pub
const
MARGIN
_STYLES
:
[(
&
str
,
&
str
);
7
]
=
[
pub
const
CONTROL
_STYLES
:
[(
&
str
,
&
str
);
14
]
=
[
(
"m"
,
"margin"
),
(
"mt"
,
"margin-top"
),
(
"mr"
,
"margin-right"
),
...
...
@@ -286,4 +286,11 @@ pub const MARGIN_STYLES: [(&str, &str); 7] = [
(
"ml"
,
"margin-left"
),
(
"mx"
,
"margin-left margin-right"
),
(
"my"
,
"margin-top margin-bottom"
),
(
"p"
,
"padding"
),
(
"pt"
,
"padding-top"
),
(
"pr"
,
"padding-right"
),
(
"pb"
,
"padding-bottom"
),
(
"pl"
,
"padding-left"
),
(
"px"
,
"padding-left padding-right"
),
(
"py"
,
"padding-top padding-bottom"
),
];
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment