1 Star 0 Fork 1

码字/relationship

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
gulpfile.js 2.18 KB
一键复制 编辑 原始数据 按行查看 历史
PASSER-BY 提交于 2023-10-16 22:52 . updated 代码优化
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']))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zoumiao666/relationship.git
git@gitee.com:zoumiao666/relationship.git
zoumiao666
relationship
relationship
master

搜索帮助