Repository navigation
Expand file tree
/
Copy pathpostcss.config.mjs
More file actions
67 lines (56 loc) · 1.89 KB
/
Copy pathpostcss.config.mjs
File metadata and controls
67 lines (56 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import autoprefixer from "autoprefixer";
import cssnano from "cssnano";
import cssnanoPresetAdvanced from "cssnano-preset-advanced";
import postcssCombineDuplicatedSelectors from "postcss-combine-duplicated-selectors";
import postcssCombineMediaQuery from "postcss-combine-media-query";
import postcssImport from "postcss-import";
import postcssReporter from "postcss-reporter";
import postcssUrl from "postcss-url";
import tailwindcss from "tailwindcss";
import tailwindcssNesting from "tailwindcss/nesting/index.js";
const buildId = new Date().getTime();
export default {
plugins: [
postcssImport(),
postcssUrl([
{
filter: "**/Asset/**",
url: (asset) => {
if (asset.url.includes("?Time=")) {
return asset.url;
}
return `${asset.url}?Time=${buildId}`;
},
},
]),
tailwindcssNesting(),
tailwindcss("./tailwind.config.js"),
postcssCombineMediaQuery(),
postcssCombineDuplicatedSelectors({
removeDuplicatedProperties: true,
removeDuplicatedValues: false,
}),
autoprefixer(),
cssnano({
// discardUnused's fontFace check only sees literal font-family
// strings; it can't resolve `font-family: var(--FontSans)`
// indirection (Global.css → Base.css), so it drops every
// @font-face rule as "unused". Keep font-face pruning off;
// leave the rest of discardUnused (keyframes, counter-style,
// namespace) at its default.
//
// The preset is the imported function, not the string
// "advanced": cssnano resolves the string to the installed
// `cssnano-preset-advanced` anyway and says so on every build
// (`[CSSNANO_INSTALLED_PRESET] Warning`), which is noise
// standing where a real CSS warning should be. The imported
// function is the same preset, byte-identical output, one
// line of log less.
preset: [
cssnanoPresetAdvanced,
{ discardUnused: { fontFace: false } },
],
}),
postcssReporter(),
],
};