[gulpfile.js] Remove the cleanup
parameter in preprocessCSS
helper function
Every single call-site has always passed in `true` for this parameter, ever since the function was first added back in PR 8023. Hence the parameter appears to be completely unnecessary, which is why it's removed and the function is updated to *unconditionally* strip out any license headers (in the middle of the file).
This commit is contained in:
parent
90c5e9882b
commit
6776efe491
21
gulpfile.js
21
gulpfile.js
@ -801,16 +801,15 @@ gulp.task("cmaps", function (done) {
|
||||
done();
|
||||
});
|
||||
|
||||
function preprocessCSS(source, mode, defines, cleanup) {
|
||||
function preprocessCSS(source, mode, defines) {
|
||||
const outName = getTempFile("~preprocess", ".css");
|
||||
builder.preprocessCSS(mode, source, outName);
|
||||
let out = fs.readFileSync(outName).toString();
|
||||
fs.unlinkSync(outName);
|
||||
if (cleanup) {
|
||||
// Strip out all license headers in the middle.
|
||||
const reg = /\n\/\* Copyright(.|\n)*?Mozilla Foundation(.|\n)*?\*\//g;
|
||||
out = out.replace(reg, "");
|
||||
}
|
||||
|
||||
// Strip out all license headers in the middle.
|
||||
const reg = /\n\/\* Copyright(.|\n)*?Mozilla Foundation(.|\n)*?\*\//g;
|
||||
out = out.replace(reg, "");
|
||||
|
||||
const i = source.lastIndexOf("/");
|
||||
return createStringSource(source.substr(i + 1), out);
|
||||
@ -849,7 +848,7 @@ function buildGeneric(defines, dir) {
|
||||
createStandardFontBundle().pipe(gulp.dest(dir + "web/standard_fonts")),
|
||||
|
||||
preprocessHTML("web/viewer.html", defines).pipe(gulp.dest(dir + "web")),
|
||||
preprocessCSS("web/viewer.css", "generic", defines, true)
|
||||
preprocessCSS("web/viewer.css", "generic", defines)
|
||||
.pipe(postcss([calc(), autoprefixer(AUTOPREFIXER_CONFIG)]))
|
||||
.pipe(gulp.dest(dir + "web")),
|
||||
|
||||
@ -925,7 +924,7 @@ function buildComponents(defines, dir) {
|
||||
return merge([
|
||||
createComponentsBundle(defines).pipe(gulp.dest(dir)),
|
||||
gulp.src(COMPONENTS_IMAGES).pipe(gulp.dest(dir + "images")),
|
||||
preprocessCSS("web/pdf_viewer.css", "components", defines, true)
|
||||
preprocessCSS("web/pdf_viewer.css", "components", defines)
|
||||
.pipe(postcss([calc(), autoprefixer(AUTOPREFIXER_CONFIG)]))
|
||||
.pipe(gulp.dest(dir)),
|
||||
]);
|
||||
@ -1015,7 +1014,7 @@ function buildMinified(defines, dir) {
|
||||
createStandardFontBundle().pipe(gulp.dest(dir + "web/standard_fonts")),
|
||||
|
||||
preprocessHTML("web/viewer.html", defines).pipe(gulp.dest(dir + "web")),
|
||||
preprocessCSS("web/viewer.css", "minified", defines, true)
|
||||
preprocessCSS("web/viewer.css", "minified", defines)
|
||||
.pipe(postcss([calc(), autoprefixer(AUTOPREFIXER_CONFIG)]))
|
||||
.pipe(gulp.dest(dir + "web")),
|
||||
|
||||
@ -1252,7 +1251,7 @@ gulp.task(
|
||||
preprocessHTML("web/viewer.html", defines).pipe(
|
||||
gulp.dest(MOZCENTRAL_CONTENT_DIR + "web")
|
||||
),
|
||||
preprocessCSS("web/viewer.css", "mozcentral", defines, true)
|
||||
preprocessCSS("web/viewer.css", "mozcentral", defines)
|
||||
.pipe(
|
||||
postcss([
|
||||
autoprefixer({
|
||||
@ -1344,7 +1343,7 @@ gulp.task(
|
||||
preprocessHTML("web/viewer.html", defines).pipe(
|
||||
gulp.dest(CHROME_BUILD_CONTENT_DIR + "web")
|
||||
),
|
||||
preprocessCSS("web/viewer.css", "chrome", defines, true)
|
||||
preprocessCSS("web/viewer.css", "chrome", defines)
|
||||
.pipe(
|
||||
postcss([autoprefixer({ overrideBrowserslist: ["Chrome >= 73"] })])
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user