From 4f54f4cc462469896a716b46bebc70a61103d2a6 Mon Sep 17 00:00:00 2001 From: Maledong Date: Thu, 7 Mar 2019 07:08:41 +0800 Subject: [PATCH] =?UTF-8?q?Refactor=EF=BC=9ARe-use=20the=20same=20label=20?= =?UTF-8?q?with=20the=20same=20variables=20(#2141)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor to take the labels into the same variable to reuse it. --- build.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build.js b/build.js index 9858cc28e3848..57b2c0158f189 100755 --- a/build.js +++ b/build.js @@ -58,7 +58,8 @@ function i18nJSON (lang) { // english one. function buildLocale (source, locale, opts) { console.log(`[metalsmith] build/${locale} started`) - console.time(`[metalsmith] build/${locale} finished`) + const labelForBuild = `[metalsmith] build/${locale} finished` + console.time(labelForBuild) const metalsmith = Metalsmith(__dirname) metalsmith // Sets global metadata imported from the locale's respective site.json. @@ -167,7 +168,7 @@ function buildLocale (source, locale, opts) { // completion. metalsmith.build((err) => { if (err) { throw err } - console.timeEnd(`[metalsmith] build/${locale} finished`) + console.timeEnd(labelForBuild) }) } @@ -226,7 +227,8 @@ function githubLinks (options) { // This function builds the layouts folder for all the Stylus files. function buildLayouts () { console.log('[metalsmith] build/layouts started') - console.time('[metalsmith] build/layouts finished') + const labelForBuild = '[metalsmith] build/layouts finished' + console.time(labelForBuild) fs.mkdir(path.join(__dirname, 'build'), () => { fs.mkdir(path.join(__dirname, 'build', 'layouts'), () => { @@ -249,7 +251,7 @@ function buildLayouts () { // completion. metalsmith.build((err) => { if (err) { throw err } - console.timeEnd('[metalsmith] build/layouts finished') + console.timeEnd(labelForBuild) }) }) })