Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Toolchain
sgc
Commits
f3ccedc8
Commit
f3ccedc8
authored
Aug 30, 2018
by
Philipp Nowinski
Browse files
[BUGFIX] fix error handling an writing of svg files
parent
487a27aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/tasks/css.js
View file @
f3ccedc8
...
...
@@ -105,14 +105,18 @@ module.exports = class Css extends Task {
const
render
=
util
.
promisify
(
sass
.
render
);
const
sourceMapPath
=
this
.
_getSourceMapsPath
(
_output
);
let
compiledSass
=
await
render
({
file
:
_input
,
outFile
:
_output
,
outputStyle
:
'
expanded
'
,
sourceMap
:
this
.
_config
.
cssPipeline
.
sourceMaps
,
sourceMapEmbed
:
false
,
precision
:
8
});
try
{
let
compiledSass
=
await
render
({
file
:
_input
,
outFile
:
_output
,
outputStyle
:
'
expanded
'
,
sourceMap
:
this
.
_config
.
cssPipeline
.
sourceMaps
,
sourceMapEmbed
:
false
,
precision
:
8
});
}
catch
(
_error
)
{
return
this
.
_logger
.
error
(
_error
.
stack
);
}
let
cssString
=
this
.
_imageDimensions
(
compiledSass
.
css
.
toString
());
...
...
@@ -174,15 +178,18 @@ module.exports = class Css extends Task {
* Creates the inline-svg partial
*/
async
_svg
()
{
const
svgPartial
=
await
new
InlineSvg
(
this
.
_getFullPath
(
this
.
_config
.
directories
.
svg
),
{
template
:
'
sgc-core/inline-svg-template.mustache
'
}
);
const
partialFilePath
=
path
.
join
(
this
.
_getFullPath
(
this
.
_config
.
directories
.
sass
),
'
_svg.scss
'
);
this
.
_logger
.
success
(
`Ẁritten
${
chalk
.
white
(
path
.
basename
(
partialFilePath
))}
`
);
return
this
.
_writeFile
(
partialFilePath
,
svgPartial
);
const
svgFolderPath
=
this
.
_getFullPath
(
this
.
_config
.
directories
.
svg
);
if
(
fs
.
existsSync
(
svgFolderPath
))
{
const
svgPartial
=
await
new
InlineSvg
(
svgFolderPath
,
{
template
:
'
sgc-core/inline-svg-template.mustache
'
}
);
const
partialFilePath
=
path
.
join
(
this
.
_getFullPath
(
this
.
_config
.
directories
.
sass
),
'
_svg.scss
'
);
this
.
_logger
.
success
(
`Ẁritten
${
chalk
.
white
(
path
.
basename
(
partialFilePath
))}
`
);
this
.
_writeFile
(
partialFilePath
,
svgPartial
);
}
}
/**
...
...
Write
Preview
Supports
Markdown
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