Use Webfonts from jslib instead of downloading them using gulp (#1205)

* Use Webfonts from jslib instead of downloading them using gulp

* Bump jslib.
This commit is contained in:
Oscar Hinton 2021-09-24 18:24:58 +02:00 committed by GitHub
parent ce3311a0dc
commit f8b0c2ffe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 1657 additions and 6449 deletions

View File

@ -1,37 +0,0 @@
const gulp = require('gulp');
const googleWebFonts = require('gulp-google-webfonts');
const del = require('del');
const package = require('./package.json');
const fs = require('fs');
const paths = {
node_modules: './node_modules/',
src: './src/',
build: './build/',
cssDir: './src/css/',
};
function clean() {
return del([paths.cssDir]);
}
function webfonts() {
return gulp.src('./webfonts.list')
.pipe(googleWebFonts({
fontsDir: 'webfonts',
cssFilename: 'webfonts.css',
format: 'woff',
}))
.pipe(gulp.dest(paths.cssDir));
};
function version(cb) {
fs.writeFileSync(paths.build + 'version.json', '{"version":"' + package.version + '"}');
cb();
}
exports.clean = clean;
exports.webfonts = gulp.series(clean, webfonts);
exports.prebuild = gulp.series(clean, webfonts);
exports.version = version;
exports.postdist = version;

2
jslib

@ -1 +1 @@
Subproject commit b7429b0c0cdca8783fd9fa304918ee91f23c6f76
Subproject commit 2c892eb3a2a9aff1e238146b037e6f3eb5dacf9a

8042
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,10 +11,10 @@
"symlink:win": "rm -rf ./jslib && cmd /c mklink /J .\\jslib ..\\jslib",
"symlink:mac": "npm run symlink:lin",
"symlink:lin": "rm -rf ./jslib && ln -s ../jslib ./jslib",
"build:oss": "gulp prebuild && webpack",
"build:bit": "gulp prebuild && webpack -c bitwarden_license/webpack.config.js",
"build:oss:watch": "gulp prebuild && webpack serve",
"build:bit:watch": "gulp prebuild && webpack serve -c bitwarden_license/webpack.config.js",
"build:oss": "webpack",
"build:bit": "webpack -c bitwarden_license/webpack.config.js",
"build:oss:watch": "webpack serve",
"build:bit:watch": "webpack serve -c bitwarden_license/webpack.config.js",
"build:bit:dev": "cross-env ENV=development npm run build:bit",
"build:bit:dev:watch": "cross-env ENV=development npm run build:bit:watch",
"build:bit:qa": "cross-env NODE_ENV=production ENV=qa npm run build:bit",
@ -24,9 +24,9 @@
"build:oss:selfhost:prod": "cross-env ENV=selfhosted NODE_ENV=production npm run build:oss",
"build:bit:selfhost:prod": "cross-env ENV=selfhosted NODE_ENV=production npm run build:bit",
"clean:l10n": "git push origin --delete l10n_master",
"dist:bit:cloud": "npm run build:bit:cloud && gulp postdist",
"dist:oss:selfhost": "npm run build:oss:selfhost:prod && gulp postdist",
"dist:bit:selfhost": "npm run build:bit:selfhost:prod && gulp postdist",
"dist:bit:cloud": "npm run build:bit:cloud",
"dist:oss:selfhost": "npm run build:oss:selfhost:prod",
"dist:bit:selfhost": "npm run build:bit:selfhost:prod",
"deploy": "npm run dist:bit && gh-pages -d build",
"deploy:dev": "npm run dist:bit && gh-pages -d build -r git@github.com:kspearrin/bitwarden-web-dev.git",
"lint": "tslint 'src/**/*.ts' 'bitwarden_license/src/**/*.ts' || true",
@ -46,8 +46,6 @@
"del": "^6.0.0",
"file-loader": "^6.2.0",
"gh-pages": "^3.1.0",
"gulp": "^4.0.2",
"gulp-google-webfonts": "^4.0.0",
"html-loader": "^1.3.2",
"html-webpack-plugin": "^4.5.1",
"mini-css-extract-plugin": "^1.5.0",

View File

@ -1,4 +1,4 @@
@import "../css/webfonts.css";
@import "../../jslib/angular/src/scss/webfonts.css";
$primary: #175DDC;
$primary-accent: #1252A3;

1
src/version.json Normal file
View File

@ -0,0 +1 @@
{"version":"process.env.APPLICATION_VERSION"}

View File

@ -136,6 +136,12 @@ const plugins = [
{ from: './src/scripts', to: 'scripts' },
{ from: './node_modules/qrious/dist/qrious.min.js', to: 'scripts' },
{ from: './node_modules/braintree-web-drop-in/dist/browser/dropin.js', to: 'scripts' },
{
from: './src/version.json',
transform (content, path) {
return content.toString().replace('process.env.APPLICATION_VERSION', pjson.version);
},
}
],
}),
new MiniCssExtractPlugin({