Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
juuust-icon
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lift.hurley
juuust-icon
Commits
67ae5576
Commit
67ae5576
authored
Nov 07, 2019
by
leadream
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix CamelCase issue
parent
c8a580fd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
build.js
bin/build.js
+4
-3
processSvg.js
bin/processSvg.js
+1
-1
template.js
bin/template.js
+1
-0
No files found.
bin/build.js
View file @
67ae5576
...
@@ -44,10 +44,11 @@ const generateIndex = () => {
...
@@ -44,10 +44,11 @@ const generateIndex = () => {
}
}
// generate attributes code
// generate attributes code
const
attrsToString
=
(
attrs
)
=>
{
const
attrsToString
=
(
attrs
,
style
)
=>
{
console
.
log
(
style
)
return
Object
.
keys
(
attrs
).
map
((
key
)
=>
{
return
Object
.
keys
(
attrs
).
map
((
key
)
=>
{
// should distinguish fill or stroke
// should distinguish fill or stroke
if
(
key
===
'width'
||
key
===
'height'
||
key
===
'fill'
||
key
===
'stroke'
)
{
if
(
key
===
'width'
||
key
===
'height'
||
key
===
style
)
{
return
key
+
'={'
+
attrs
[
key
]
+
'}'
;
return
key
+
'={'
+
attrs
[
key
]
+
'}'
;
}
}
if
(
key
===
'otherProps'
)
{
if
(
key
===
'otherProps'
)
{
...
@@ -66,7 +67,7 @@ const generateIconCode = async ({name}) => {
...
@@ -66,7 +67,7 @@ const generateIconCode = async ({name}) => {
const
code
=
fs
.
readFileSync
(
location
)
const
code
=
fs
.
readFileSync
(
location
)
const
svgCode
=
await
processSvg
(
code
)
const
svgCode
=
await
processSvg
(
code
)
const
ComponentName
=
names
.
componentName
const
ComponentName
=
names
.
componentName
const
element
=
getElementCode
(
ComponentName
,
attrsToString
(
getAttrs
(
names
.
style
)),
svgCode
)
const
element
=
getElementCode
(
ComponentName
,
attrsToString
(
getAttrs
(
names
.
style
)
,
names
.
style
),
svgCode
)
const
component
=
format
({
const
component
=
format
({
text
:
element
,
text
:
element
,
eslintConfig
:
{
eslintConfig
:
{
...
...
bin/processSvg.js
View file @
67ae5576
...
@@ -50,8 +50,8 @@ async function processSvg(svg) {
...
@@ -50,8 +50,8 @@ async function processSvg(svg) {
// remove semicolon inserted by prettier
// remove semicolon inserted by prettier
// because prettier thinks it's formatting JSX not HTML
// because prettier thinks it's formatting JSX not HTML
.
then
(
svg
=>
svg
.
replace
(
/;/g
,
''
))
.
then
(
svg
=>
svg
.
replace
(
/;/g
,
''
))
.
then
(
svg
=>
svg
.
replace
(
/
([
a-z
]
+
)
-
([
a-z
]
+
)
=/g
,
(
_
,
a
,
b
)
=>
`
${
a
}${
CamelCase
(
b
)}
=`
))
.
then
(
removeSVGElement
)
.
then
(
removeSVGElement
)
.
then
(
svg
=>
svg
.
replace
(
/
([
a-z
]
+
)
-
([
a-z
]
+
)
=/g
,
(
_
,
a
,
b
)
=>
`
${
a
}${
CamelCase
(
b
)}
=`
))
return
optimized
;
return
optimized
;
}
}
...
...
bin/template.js
View file @
67ae5576
...
@@ -10,6 +10,7 @@ const getAttrs = (style) => {
...
@@ -10,6 +10,7 @@ const getAttrs = (style) => {
otherProps
:
'...otherProps'
otherProps
:
'...otherProps'
}
}
const
strokeAttrs
=
{
const
strokeAttrs
=
{
fill
:
'none'
,
stroke
:
'color'
,
stroke
:
'color'
,
strokeWidth
:
2
,
strokeWidth
:
2
,
strokeLinecap
:
'round'
,
strokeLinecap
:
'round'
,
...
...
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