Build translations with webpack

Convert the `po2json` script into a webpack plugin, and integrate the
(now trivial) po.empty.js template.

This is the last step for building the entire dist/ directory with
`npm run build` (i.e. a tool that web developers are familiar with),
and not having a split webpack+make toolchain any more.
This commit is contained in:
Martin Pitt 2021-01-05 14:52:59 +01:00 committed by GitHub
parent 07017f79d8
commit 7f6ef51c12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 81 additions and 137 deletions

View file

@ -1,11 +1,14 @@
const path = require("path");
const childProcess = require('child_process');
const copy = require("copy-webpack-plugin");
const extract = require("mini-css-extract-plugin");
const TerserJSPlugin = require('terser-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const webpack = require("webpack");
const CompressionPlugin = require("compression-webpack-plugin");
const CockpitPoPlugin = require("./src/lib/cockpit-po-plugin");
const webpack = require("webpack");
const nodedir = path.resolve((process.env.SRCDIR || __dirname), "node_modules");
@ -20,7 +23,8 @@ const copy_files = [
const plugins = [
new copy({ patterns: copy_files }),
new extract({filename: "[name].css"})
new extract({filename: "[name].css"}),
new CockpitPoPlugin(),
];
/* Only minimize when in production mode */