1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-24 11:55:50 +01:00

gulp task for webfonts

This commit is contained in:
Kyle Spearrin 2018-08-08 12:47:54 -04:00
parent 057b684f02
commit 9e7438e0b0
7 changed files with 1613 additions and 103 deletions

1
.gitignore vendored
View File

@ -4,6 +4,7 @@ node_modules
npm-debug.log npm-debug.log
vwd.webinfo vwd.webinfo
dist/ dist/
css/
*.crx *.crx
*.pem *.pem
build/ build/

25
gulpfile.js Normal file
View File

@ -0,0 +1,25 @@
const gulp = require('gulp');
const googleWebFonts = require('gulp-google-webfonts');
const del = require('del');
const paths = {
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));
};
gulp.task('clean', clean);
gulp.task('webfonts', ['clean'], webfonts);
gulp.task('prebuild:renderer', ['webfonts']);

2
jslib

@ -1 +1 @@
Subproject commit 3429b57db42a3e1e9948b870bf24fcc02ebc8a99 Subproject commit 4ca7a9709e9ccd0e67ce09309ae605f2057bf089

1660
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -26,8 +26,8 @@
"lint:fix": "tslint src/**/*.ts --fix", "lint:fix": "tslint src/**/*.ts --fix",
"build": "concurrently -n Main,Rend -c yellow,cyan \"npm run build:main\" \"npm run build:renderer\"", "build": "concurrently -n Main,Rend -c yellow,cyan \"npm run build:main\" \"npm run build:renderer\"",
"build:main": "webpack --config webpack.main.js", "build:main": "webpack --config webpack.main.js",
"build:renderer": "webpack --config webpack.renderer.js", "build:renderer": "gulp prebuild:renderer && webpack --config webpack.renderer.js",
"build:renderer:watch": "webpack --config webpack.renderer.js --watch", "build:renderer:watch": "gulp prebuild:renderer && webpack --config webpack.renderer.js --watch",
"electron": "npm run build:main && concurrently -k -n Main,Rend -c yellow,cyan \"electron --inspect=5858 ./build --watch\" \"npm run build:renderer:watch\"", "electron": "npm run build:main && concurrently -k -n Main,Rend -c yellow,cyan \"electron --inspect=5858 ./build --watch\" \"npm run build:renderer:watch\"",
"clean:dist": "rimraf ./dist/*", "clean:dist": "rimraf ./dist/*",
"clean:l10n": "git push origin --delete l10n_master", "clean:l10n": "git push origin --delete l10n_master",
@ -202,6 +202,7 @@
"concurrently": "3.5.1", "concurrently": "3.5.1",
"copy-webpack-plugin": "^4.2.0", "copy-webpack-plugin": "^4.2.0",
"css-loader": "^0.28.7", "css-loader": "^0.28.7",
"del": "^3.0.0",
"electron": "2.0.5", "electron": "2.0.5",
"electron-builder": "^20.25.0", "electron-builder": "^20.25.0",
"electron-rebuild": "1.8.1", "electron-rebuild": "1.8.1",
@ -209,7 +210,8 @@
"extract-text-webpack-plugin": "^3.0.1", "extract-text-webpack-plugin": "^3.0.1",
"file-loader": "^1.1.5", "file-loader": "^1.1.5",
"font-awesome": "4.7.0", "font-awesome": "4.7.0",
"google-fonts-webpack-plugin": "^0.4.4", "gulp": "^3.9.1",
"gulp-google-webfonts": "^2.0.0",
"html-loader": "^0.5.1", "html-loader": "^0.5.1",
"html-webpack-plugin": "^2.30.1", "html-webpack-plugin": "^2.30.1",
"node-abi": "^2.4.1", "node-abi": "^2.4.1",

1
webfonts.list Normal file
View File

@ -0,0 +1 @@
Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext

View File

@ -2,7 +2,6 @@ const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const merge = require('webpack-merge'); const merge = require('webpack-merge');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const GoogleFontsPlugin = require("google-fonts-webpack-plugin");
const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin');
const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin; const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
@ -84,9 +83,8 @@ const renderer = {
options: { options: {
name: '[name].[ext]', name: '[name].[ext]',
outputPath: 'fonts/', outputPath: 'fonts/',
publicPath: '../' },
} }],
}]
}, },
{ {
test: /\.scss$/, test: /\.scss$/,
@ -105,19 +103,6 @@ const renderer = {
] ]
}, },
plugins: [ plugins: [
new GoogleFontsPlugin({
fonts: [
{
family: 'Open Sans',
variants: ['300', '300italic', '400', '400italic', '600', '600italic',
'700', '700italic', '800', '800italic'],
subsets: ['cyrillic', 'cyrillic-ext', 'greek', 'greek-ext', 'latin', 'latin-ext']
}
],
formats: ['woff2'],
path: 'fonts/',
filename: 'css/fonts.css'
}),
new AngularCompilerPlugin({ new AngularCompilerPlugin({
tsConfigPath: 'tsconfig.json', tsConfigPath: 'tsconfig.json',
entryModule: 'src/app/app.module#AppModule', entryModule: 'src/app/app.module#AppModule',