mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Enable plugins in config
This commit is contained in:
parent
3e2a2b7942
commit
698d47e221
@ -1,9 +1,15 @@
|
|||||||
const cssvariables = require("postcss-css-variables");
|
const cssvariables = require("postcss-css-variables");
|
||||||
const flexbugsFixes = require("postcss-flexbugs-fixes");
|
const flexbugsFixes = require("postcss-flexbugs-fixes");
|
||||||
|
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");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const manifest = require("./package.json");
|
const manifest = require("./package.json");
|
||||||
const version = manifest.version;
|
const version = manifest.version;
|
||||||
|
const compiledVariables = new Map();
|
||||||
|
const derive = require("./scripts/postcss/color").derive;
|
||||||
|
const replacer = require("./scripts/postcss/svg-colorizer").buildColorizedSVG;
|
||||||
|
|
||||||
const commonOptions = {
|
const commonOptions = {
|
||||||
logLevel: "warn",
|
logLevel: "warn",
|
||||||
@ -32,11 +38,14 @@ const commonOptions = {
|
|||||||
css: {
|
css: {
|
||||||
postcss: {
|
postcss: {
|
||||||
plugins: [
|
plugins: [
|
||||||
cssvariables({
|
compileVariables({derive, compiledVariables}),
|
||||||
preserve: (declaration) => {
|
urlVariables({compileVariables}),
|
||||||
return declaration.value.indexOf("var(--ios-") == 0;
|
urlProcessor({replacer}),
|
||||||
}
|
// cssvariables({
|
||||||
}),
|
// preserve: (declaration) => {
|
||||||
|
// return declaration.value.indexOf("var(--ios-") == 0;
|
||||||
|
// }
|
||||||
|
// }),
|
||||||
// the grid option creates some source fragment that causes the vite warning reporter to crash because
|
// 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.
|
// it wants to log a warning on a line that does not exist in the source fragment.
|
||||||
// autoprefixer({overrideBrowserslist: ["IE 11"], grid: "no-autoplace"}),
|
// autoprefixer({overrideBrowserslist: ["IE 11"], grid: "no-autoplace"}),
|
||||||
@ -46,4 +55,4 @@ const commonOptions = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = commonOptions;
|
module.exports = { commonOptions, compiledVariables };
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
const injectWebManifest = require("./scripts/build-plugins/manifest");
|
const injectWebManifest = require("./scripts/build-plugins/manifest");
|
||||||
const {injectServiceWorker, createPlaceholderValues} = require("./scripts/build-plugins/service-worker");
|
const {injectServiceWorker, createPlaceholderValues} = require("./scripts/build-plugins/service-worker");
|
||||||
|
const themeBuilder = require("./scripts/build-plugins/rollup-plugin-build-themes");
|
||||||
const {defineConfig} = require('vite');
|
const {defineConfig} = require('vite');
|
||||||
const mergeOptions = require('merge-options').bind({concatArrays: true});
|
const mergeOptions = require('merge-options').bind({concatArrays: true});
|
||||||
const commonOptions = require("./vite.common-config.js");
|
const {commonOptions, compiledVariables} = require("./vite.common-config.js");
|
||||||
|
|
||||||
export default defineConfig(({mode}) => {
|
export default defineConfig(({mode}) => {
|
||||||
const definePlaceholders = createPlaceholderValues(mode);
|
const definePlaceholders = createPlaceholderValues(mode);
|
||||||
@ -15,6 +16,7 @@ export default defineConfig(({mode}) => {
|
|||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
themeBuilder({manifestLocations: ["./src/platform/web/ui/css/themes/element"], compiledVariables}),
|
||||||
// important this comes before service worker
|
// important this comes before service worker
|
||||||
// otherwise the manifest and the icons it refers to won't be cached
|
// otherwise the manifest and the icons it refers to won't be cached
|
||||||
injectWebManifest("assets/manifest.json"),
|
injectWebManifest("assets/manifest.json"),
|
||||||
|
Loading…
Reference in New Issue
Block a user