1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

[gulpfile.js] Use the regular defines in the preprocessCSS function

Rather than *manually* specifying a "mode", we can simply use the regular `defines` directly instead. To improve consistency, in the `external/builder/builder.js` file, a couple of parameters are also re-named.
This commit is contained in:
Jonas Jenwald 2022-03-15 13:53:49 +01:00
parent 489e9ff7d3
commit 5180bafb8f
2 changed files with 15 additions and 15 deletions

View file

@ -199,7 +199,7 @@ function preprocess(inFilename, outFilename, defines) {
}
exports.preprocess = preprocess;
function preprocessCSS(mode, source, destination) {
function preprocessCSS(inFilename, outFilename, defines) {
function hasPrefixedMozcentral(line) {
return /(^|\W)-(ms|o|webkit)-\w/.test(line);
}
@ -262,16 +262,16 @@ function preprocessCSS(mode, source, destination) {
return lines.join("\n");
}
if (!mode) {
throw new Error("Invalid CSS preprocessor mode");
if (!defines) {
throw new Error("Missing CSS preprocessor defines.");
}
let content = fs.readFileSync(source, "utf8").toString();
content = expandImports(content, source);
if (mode === "mozcentral") {
let content = fs.readFileSync(inFilename, "utf8").toString();
content = expandImports(content, inFilename);
if (defines.MOZCENTRAL) {
content = removePrefixed(content, hasPrefixedMozcentral);
}
fs.writeFileSync(destination, content);
fs.writeFileSync(outFilename, content);
}
exports.preprocessCSS = preprocessCSS;