From 0b7db01af2f2a94217760f8a5e067557fa730da3 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Fri, 29 May 2020 14:47:22 +0800 Subject: [PATCH] chore(gulp): update gulpfile --- gulpfile.js | 34 +++++++++++++++++++--------------- src/disqus.js | 2 +- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 12f3834..87ce1e0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -20,27 +20,31 @@ const cssBanner = ['/*! DisqusJS - Default Theme | v<%= pkg.version %>', ].join(' | '); +const browserslist = [ + 'last 3 versions', + 'since 2016', + '> 1%', + 'Chrome >= 49', + 'Firefox >= 50', + 'ie >= 11', + 'Safari >= 9', +] + const configs = { - browsers: [ - 'last 2 versions', - 'since 2015', - '> 1%', - 'Chrome >= 49', - 'Firefox >= 44', - 'ie >= 10', - 'Safari >= 9', - ], + autoprefixer: { + overrideBrowserslist: browserslist + }, cleanCSS: { - compatibility: 'ie10' + compatibility: 'ie11' }, }; gulp.task('minify-js', () => gulp.src('src/**/*.js') .pipe(babel({ - "presets": [ - ["@babel/env", { - "targets": configs.browsers, - "loose": true + 'presets': [ + ['@babel/env', { + 'targets': browserslist, + 'loose': true }] ] })) @@ -51,7 +55,7 @@ gulp.task('minify-js', () => gulp.src('src/**/*.js') .pipe(gulp.dest('dist'))); gulp.task('minify-css', () => gulp.src('src/**/*.css') - .pipe(autoprefixer(configs.browsers)) + .pipe(autoprefixer(configs.autoprefixer)) .pipe(cleanCSS(configs.cleanCSS)) .pipe(header(cssBanner, { pkg })) .pipe(gulp.dest('dist'))); diff --git a/src/disqus.js b/src/disqus.js index 2aa26ef..1e129ca 100644 --- a/src/disqus.js +++ b/src/disqus.js @@ -271,7 +271,7 @@ function DisqusJS(config) { disqusjs.page = { id, title, isClosed, length, comment: [] }; // 在 #disqus_thread 中填充 DisqusJS Container - $$(DISQUS_CONTAINER_EL_ID).innerHTML = `
评论基础模式加载中... ${HTML_TPL_EL_ASK_FOR_FULL}
${HTML_TPL_EL_HEADER(resp.posts, disqusjs.config.siteName)}

    评论列表加载中...

加载更多评论
${HTML_TPL_EL_FOOTER}
`; + $$(DISQUS_CONTAINER_EL_ID).innerHTML = `
评论基础模式加载中... ${HTML_TPL_EL_ASK_FOR_FULL}
${HTML_TPL_EL_HEADER(length, disqusjs.config.siteName)}

    评论列表加载中...

加载更多评论
${HTML_TPL_EL_FOOTER}
`; assignClickEventForAskForFulButton();