Skip to content

Commit

Permalink
lazy load templates
Browse files Browse the repository at this point in the history
  • Loading branch information
stroncium committed Jul 22, 2019
1 parent 21ed116 commit c22c625
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
const ansiStyles = require('ansi-styles');
const {stdout: stdoutColor} = require('supports-color');
const template = require('./templates');
const {
stringReplaceAll,
stringEncaseCRLFWithFirstIndex
Expand Down Expand Up @@ -185,6 +184,7 @@ const applyStyle = (self, string) => {
return openAll + string + closeAll;
};

let template;
const chalkTag = (chalk, ...strings) => {
const [firstString] = strings;

Expand All @@ -204,6 +204,9 @@ const chalkTag = (chalk, ...strings) => {
);
}

if (template === undefined) {
template = require('./templates');
}
return template(chalk, parts.join(''));
};

Expand Down

0 comments on commit c22c625

Please sign in to comment.