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 }