lazy load templates
This commit is contained in:
parent
09e5a22cb7
commit
b21018deae
1 changed files with 4 additions and 1 deletions
|
|
@ -1,7 +1,6 @@
|
|||
'use strict';
|
||||
const ansiStyles = require('ansi-styles');
|
||||
const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');
|
||||
const template = require('./templates');
|
||||
const {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
|
|
@ -185,6 +184,7 @@ const applyStyle = (self, string) => {
|
|||
return openAll + string + closeAll;
|
||||
};
|
||||
|
||||
let template;
|
||||
const chalkTag = (chalk, ...strings) => {
|
||||
const [firstString] = strings;
|
||||
|
||||
|
|
@ -204,6 +204,9 @@ const chalkTag = (chalk, ...strings) => {
|
|||
);
|
||||
}
|
||||
|
||||
if (template === undefined) {
|
||||
template = require('./templates');
|
||||
}
|
||||
return template(chalk, parts.join(''));
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue