2021-12-10 20:33:17 +05:30
|
|
|
const cssvariables = require("postcss-css-variables");
|
|
|
|
const flexbugsFixes = require("postcss-flexbugs-fixes");
|
2022-04-11 16:25:28 +05:30
|
|
|
const compileVariables = require("./scripts/postcss/css-compile-variables");
|
|
|
|
const urlVariables = require("./scripts/postcss/css-url-to-variables");
|
|
|
|
const urlProcessor = require("./scripts/postcss/css-url-processor");
|
2021-12-10 20:33:17 +05:30
|
|
|
const fs = require("fs");
|
|
|
|
const path = require("path");
|
2021-12-17 20:43:26 +05:30
|
|
|
const manifest = require("./package.json");
|
|
|
|
const version = manifest.version;
|
2022-04-11 16:25:28 +05:30
|
|
|
const compiledVariables = new Map();
|
2022-07-11 12:17:33 +05:30
|
|
|
import {buildColorizedSVG as replacer} from "./scripts/postcss/svg-colorizer.mjs";
|
2022-07-11 12:03:07 +05:30
|
|
|
import {derive} from "./scripts/postcss/color.mjs";
|
2021-12-10 20:33:17 +05:30
|
|
|
|
|
|
|
const commonOptions = {
|
2021-12-22 20:55:09 +05:30
|
|
|
logLevel: "warn",
|
2021-12-20 23:47:31 +05:30
|
|
|
publicDir: false,
|
2021-12-10 20:33:17 +05:30
|
|
|
server: {
|
|
|
|
hmr: false
|
|
|
|
},
|
2021-12-21 19:58:55 +05:30
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
// these should only be imported by the base-x package in any runtime code
|
|
|
|
// and works in the browser with a Uint8Array shim,
|
|
|
|
// rather than including a ton of polyfill code
|
|
|
|
"safe-buffer": "./scripts/package-overrides/safe-buffer/index.js",
|
|
|
|
"buffer": "./scripts/package-overrides/buffer/index.js",
|
|
|
|
}
|
|
|
|
},
|
2021-12-10 20:33:17 +05:30
|
|
|
build: {
|
|
|
|
emptyOutDir: true,
|
|
|
|
assetsInlineLimit: 0,
|
|
|
|
polyfillModulePreload: false,
|
|
|
|
},
|
2022-04-20 12:25:23 +05:30
|
|
|
assetsInclude: ['**/config.json'],
|
2021-12-10 20:33:17 +05:30
|
|
|
define: {
|
|
|
|
DEFINE_VERSION: JSON.stringify(version),
|
|
|
|
DEFINE_GLOBAL_HASH: JSON.stringify(null),
|
|
|
|
},
|
|
|
|
css: {
|
|
|
|
postcss: {
|
|
|
|
plugins: [
|
2022-04-11 16:25:28 +05:30
|
|
|
compileVariables({derive, compiledVariables}),
|
2022-06-16 21:26:16 +05:30
|
|
|
urlVariables({compiledVariables}),
|
2022-04-11 16:25:28 +05:30
|
|
|
urlProcessor({replacer}),
|
|
|
|
// cssvariables({
|
|
|
|
// preserve: (declaration) => {
|
|
|
|
// return declaration.value.indexOf("var(--ios-") == 0;
|
|
|
|
// }
|
|
|
|
// }),
|
2021-12-10 20:33:17 +05:30
|
|
|
// the grid option creates some source fragment that causes the vite warning reporter to crash because
|
|
|
|
// it wants to log a warning on a line that does not exist in the source fragment.
|
|
|
|
// autoprefixer({overrideBrowserslist: ["IE 11"], grid: "no-autoplace"}),
|
|
|
|
flexbugsFixes()
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-04-11 16:25:28 +05:30
|
|
|
module.exports = { commonOptions, compiledVariables };
|