bitwarden-estensione-browser/gulpfile.js

47 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-07-18 16:54:22 +02:00
const gulp = require('gulp');
const googleWebFonts = require('gulp-google-webfonts');
2018-07-18 17:15:23 +02:00
const del = require('del');
2018-07-21 06:11:55 +02:00
const package = require('./package.json');
const fs = require('fs');
2018-07-18 16:54:22 +02:00
2018-07-18 17:15:23 +02:00
const paths = {
node_modules: './node_modules/',
2018-07-21 06:11:55 +02:00
src: './src/',
build: './build/',
2018-07-18 17:15:23 +02:00
cssDir: './src/css/',
};
function clean() {
return del([paths.cssDir]);
}
2018-07-18 16:54:22 +02:00
2018-07-18 17:15:23 +02:00
function webfonts() {
2018-07-18 16:54:22 +02:00
return gulp.src('./webfonts.list')
.pipe(googleWebFonts({
fontsDir: 'webfonts',
2018-07-18 17:15:23 +02:00
cssFilename: 'webfonts.css',
format: 'woff',
2018-07-18 16:54:22 +02:00
}))
2018-07-18 17:15:23 +02:00
.pipe(gulp.dest(paths.cssDir));
};
2018-11-27 18:47:06 +01:00
function version(cb) {
2018-07-21 06:11:55 +02:00
fs.writeFileSync(paths.build + 'version.json', '{"version":"' + package.version + '"}');
2018-11-27 18:47:06 +01:00
cb();
2018-07-21 06:11:55 +02:00
}
// ref: https://github.com/t4t5/sweetalert/issues/890
function fixSweetAlert(cb) {
fs.writeFileSync(paths.node_modules + 'sweetalert/typings/sweetalert.d.ts',
'import swal, { SweetAlert } from "./core";export default swal;export as namespace swal;');
cb();
}
2018-11-27 18:47:06 +01:00
exports.clean = clean;
exports.webfonts = gulp.series(clean, webfonts);
exports.prebuild = gulp.series(clean, webfonts);
exports.version = version;
exports.postdist = version;
exports.fixSweetAlert = fixSweetAlert;
exports.postinstall = fixSweetAlert;