mirror of
https://github.com/danog/sass-site.git
synced 2024-11-30 04:29:17 +01:00
Updating codeExample logic to account for when there is no CSS in the code examples
This commit is contained in:
parent
a94340d10a
commit
43d62b6bef
@ -263,9 +263,9 @@ const getCanSplit = (
|
|||||||
const exampleSourceLengths = [...scssExamples, ...sassExamples].flatMap(
|
const exampleSourceLengths = [...scssExamples, ...sassExamples].flatMap(
|
||||||
(source) => source.split('\n').map((line) => line.length),
|
(source) => source.split('\n').map((line) => line.length),
|
||||||
);
|
);
|
||||||
const cssSourceLengths = cssExamples.flatMap((source) =>
|
const cssSourceLengths = cssExamples.length ? cssExamples.flatMap((source) =>
|
||||||
source.split('\n').map((line) => line.length),
|
source.split('\n').map((line) => line.length),
|
||||||
);
|
) : [0];
|
||||||
|
|
||||||
const maxSourceWidth = Math.max(...exampleSourceLengths);
|
const maxSourceWidth = Math.max(...exampleSourceLengths);
|
||||||
const maxCSSWidth = Math.max(...cssSourceLengths);
|
const maxCSSWidth = Math.max(...cssSourceLengths);
|
||||||
|
Loading…
Reference in New Issue
Block a user