Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Site.js
site
Commits
c733a907
Verified
Commit
c733a907
authored
Jun 09, 2020
by
Aral Balkan
Browse files
Remove debug logging from build scripts
parent
3ace57a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
_build/inline-svg.js
View file @
c733a907
...
@@ -26,12 +26,10 @@ function escapeRegExp(str) {
...
@@ -26,12 +26,10 @@ function escapeRegExp(str) {
SVGs
.
forEach
(
svg
=>
{
SVGs
.
forEach
(
svg
=>
{
// Inline SVGs used as CSS background images.
// Inline SVGs used as CSS background images.
if
(
svg
.
includes
(
'
emoji
'
))
{
if
(
svg
.
includes
(
'
emoji
'
))
{
console
.
log
(
'
Adding emoji
'
,
svg
)
index
=
index
.
replace
(
new
RegExp
(
escapeRegExp
(
`background-image:url(
${
svg
}
)`
),
'
g
'
),
`background-image:url('data:image/svg+xml;utf8,
${
encodeURIComponent
(
fs
.
readFileSync
(
svg
,
'
utf8
'
))}
')`
)
index
=
index
.
replace
(
new
RegExp
(
escapeRegExp
(
`background-image:url(
${
svg
}
)`
),
'
g
'
),
`background-image:url('data:image/svg+xml;utf8,
${
encodeURIComponent
(
fs
.
readFileSync
(
svg
,
'
utf8
'
))}
')`
)
}
else
if
(
svg
.
includes
(
'
illustrations
'
))
{
}
else
if
(
svg
.
includes
(
'
illustrations
'
))
{
// Inline SVGs in image tags.
// Inline SVGs in image tags.
// Note: no quotes around the src attribute as HtML has already been minified.
// Note: no quotes around the src attribute as HtML has already been minified.
console
.
log
(
'
Adding illustration
'
,
svg
,
new
RegExp
(
escapeRegExp
(
`img src=
${
svg
}
`
),
'
g
'
))
index
=
index
.
replace
(
new
RegExp
(
escapeRegExp
(
`img src=
${
svg
}
`
),
'
g
'
),
`img src=data:image/svg+xml;utf8,
${
encodeURIComponent
(
fs
.
readFileSync
(
`../
${
svg
}
`
,
'
utf8
'
))}
`
)
index
=
index
.
replace
(
new
RegExp
(
escapeRegExp
(
`img src=
${
svg
}
`
),
'
g
'
),
`img src=data:image/svg+xml;utf8,
${
encodeURIComponent
(
fs
.
readFileSync
(
`../
${
svg
}
`
,
'
utf8
'
))}
`
)
}
else
{
}
else
{
throw
new
Error
(
'
Unknown SVG type encountered:
'
,
svg
)
throw
new
Error
(
'
Unknown SVG type encountered:
'
,
svg
)
...
...
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