Skip to content

Commit

Permalink
Fix __include_inline__() input trimming
Browse files Browse the repository at this point in the history
Previously this would trim whitespace inside the arg call:

	__include_inline__('   i-get-trimmed   ');
	__include_inline__(   '   i-dont-get-included   '   );

But now instead will allow whitespace _outside_ the quote marks:

	__include_inline__(   '   i-get-included-but-not-trimmed   '   );
  • Loading branch information
alxndrsn committed Jun 11, 2018
1 parent 5d011b9 commit 2e8c12b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/templated-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require('../lib/sync-fs');

const fromFile = (projectDir, rootFile) => fromString(projectDir, fs.read(rootFile));
const fromString = (projectDir, rootText) =>
rootText.replace(/__include_inline__\('\s*([^_]*)'\s*\);/g, (_, includedFile) =>
rootText.replace(/__include_inline__\(\s*'([^']*)'\s*\);/g, (_, includedFile) =>
fs.read(`${projectDir}/${includedFile}`));

module.exports = { fromFile, fromString };

0 comments on commit 2e8c12b

Please sign in to comment.