代码拉取完成,页面将自动刷新
const gulp = require('gulp');
const rename = require("gulp-rename");
const cht = require('gulp-cht');
const rollup = require('rollup');
const terser = require('@rollup/plugin-terser');
const resolve = require('@rollup/plugin-node-resolve');
const babel = require('@rollup/plugin-babel');
const pkg = require('./package');
// copyright
let repository = pkg.repository.url.replace(/(.+)(:\/\/.+)\.git$/,'https$2');
let now = new Date();
let date = (new Date(now.getTime()-now.getTimezoneOffset()*60000)).toISOString().substr(0,10);
let banner = `/*!
* ${pkg.name} v${pkg.version}
* ${pkg.description}
* ${pkg.homepage}
*
* Copyright (c) 2016-present, ${pkg.author}
*
* Released under the ${pkg.license} License
* ${repository}
*
* Created on: ${date}
*/`;
gulp.task('build', () => {
return rollup.rollup({
input: './src/relationship.js',
plugins: [
terser(),
resolve(),
babel({
babelHelpers: 'runtime',
exclude:'node_modules/**'
})
]
}).then(bundle => {
return bundle.write({
file: './dist/relationship.min.js',
format: 'umd',
name: 'relationship',
banner
});
});
});
gulp.task('mode', () => {
return rollup.rollup({
input: './src/relationship-mode.js',
plugins: [
terser(),
resolve(),
babel({
babelHelpers: 'runtime',
exclude:'node_modules/**'
})
]
}).then(bundle => {
return bundle.write({
file: './dist/relationship-mode.min.js',
format: 'umd',
name: 'relationshipMode',
});
});
});
gulp.task('localization', () => {
// gulp.src('./index.html')
// .pipe(cht())
// .pipe(rename("zh-HK.html"))
// .pipe(gulp.dest("./"));
return gulp.src([
'dist/relationship.min.js',
'dist/relationship-mode.min.js',
]).pipe(cht())
.pipe(rename(function(path) {
path.basename = path.basename.replace('.min','.zh-HK.min');
}))
.pipe(gulp.dest('dist/'))
});
gulp.task('default', gulp.series(['build', 'mode', 'localization']))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。