web: Run cssnano over static css
This commit is contained in:
parent
7dff027345
commit
50de5d09d2
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,8 @@
|
||||||
|
# Browsers that we support
|
||||||
|
|
||||||
|
defaults
|
||||||
|
chrome >= 87
|
||||||
|
edge >= 87
|
||||||
|
firefox >= 84
|
||||||
|
iOS >= 14.1
|
||||||
|
safari >= 14.1
|
|
@ -25,12 +25,16 @@
|
||||||
"@fluent/langneg": "^0.7.0",
|
"@fluent/langneg": "^0.7.0",
|
||||||
"@tsconfig/strictest": "^2.0.5",
|
"@tsconfig/strictest": "^2.0.5",
|
||||||
"@types/mocha": "^10.0.7",
|
"@types/mocha": "^10.0.7",
|
||||||
|
"autoprefixer": "^10.4.19",
|
||||||
|
"cssnano": "^7.0.4",
|
||||||
|
"cssnano-preset-advanced": "^7.0.4",
|
||||||
"mocha": "^10.6.0",
|
"mocha": "^10.6.0",
|
||||||
|
"postcss": "^8.4.39",
|
||||||
"replace-in-file": "^8.1.0",
|
"replace-in-file": "^8.1.0",
|
||||||
"typedoc": "^0.26.4",
|
|
||||||
"typescript": "^5.5.3",
|
|
||||||
"tsx": "^4.16.2",
|
"tsx": "^4.16.2",
|
||||||
"tsx-dom": "^3.0.1"
|
"tsx-dom": "^3.0.1",
|
||||||
|
"typedoc": "^0.26.4",
|
||||||
|
"typescript": "^5.5.3"
|
||||||
},
|
},
|
||||||
"sideEffects": false
|
"sideEffects": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,23 @@
|
||||||
import { replaceInFileSync } from "replace-in-file";
|
import { replaceInFileSync } from "replace-in-file";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
import postcss from "postcss";
|
||||||
|
import cssnanoPlugin from "cssnano";
|
||||||
|
|
||||||
const css = fs
|
const originalCss = fs
|
||||||
.readFileSync("src/internal/ui/static-styles.css", "utf8")
|
.readFileSync("src/internal/ui/static-styles.css", "utf8")
|
||||||
.replaceAll("\r", "");
|
.replaceAll("\r", "");
|
||||||
|
|
||||||
|
const processor = postcss([
|
||||||
|
cssnanoPlugin({
|
||||||
|
preset: ["advanced", { autoprefixer: { add: true } }],
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
processor
|
||||||
|
.process(originalCss, { from: "src/internal/ui/static-styles.css" })
|
||||||
|
.then((result) => {
|
||||||
replaceInFileSync({
|
replaceInFileSync({
|
||||||
files: "dist/**",
|
files: "dist/**",
|
||||||
from: [/"\s*\/\*\s*%STATIC_STYLES_CSS%\s*\*\/\s*"/g],
|
from: [/"\s*\/\*\s*%STATIC_STYLES_CSS%\s*\*\/\s*"/g],
|
||||||
to: [JSON.stringify(css)],
|
to: [JSON.stringify(result.css)],
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue