From 983e864db6e3b543a102ce4d0fba996ea9961159 Mon Sep 17 00:00:00 2001 From: Brett Kyle Date: Thu, 25 Aug 2022 20:09:03 +0100 Subject: [PATCH] Remove blank lines from Nunjucks code in Examples --- lib/file-helper.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/file-helper.js b/lib/file-helper.js index 62ca2185ed..53ea6bb19a 100644 --- a/lib/file-helper.js +++ b/lib/file-helper.js @@ -37,10 +37,15 @@ exports.getNunjucksCode = path => { // Omit any `{% extends "foo.njk" %}` nunjucks code, because we extend // templates that only exist within the Design System – it's not useful to // include this in the code we expect others to copy. - let content = parsedFile.content.replace( + let content = parsedFile.content + .replace( /{%\s*extends\s*\S*\s*%}\s+/, '' ) + .replace( + /^\s*[\r\n]/gm, + '' + ) return content }