Files
zulip/postcss.config.js
Rohitt Vashishtha ddcea9c64b postcss: Cleanly import flatpickr dark theme.
We add postcss-import for night_mode.css only. This plugin inlines
the imports of external files, instead of letting the file go via
our usual webpack toolchain.

We do this so that we can use the postcss-prefixwrap plugin to scope
the third-party CSS properly and use it inside our night-mode class.

Fixes #10607.

[anders@zulip.com: Replace postcss-wrap with postcss-prefixwrap.]

Co-authored-by: Anders Kaseorg <anders@zulip.com>
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-09-13 17:12:49 -07:00

24 lines
870 B
JavaScript

"use strict";
const path = require("path");
const {media_breakpoints} = require("./static/js/css_variables");
module.exports = ({file}) => ({
plugins: [
(file.basename ?? path.basename(file)) === "night_mode.css" &&
// Add postcss-import plugin with postcss-prefixwrap to handle
// the flatpickr dark theme. We do this because flatpickr themes
// are not scoped. See https://github.com/flatpickr/flatpickr/issues/2168.
require("postcss-import")({
plugins: [require("postcss-prefixwrap")("%night-mode-block")],
}),
require("postcss-nested"),
require("postcss-extend-rule"),
require("postcss-simple-vars")({variables: media_breakpoints}),
require("postcss-calc"),
require("postcss-media-minmax"),
require("autoprefixer"),
],
});