Skip to content

Commit

Permalink
Change the return value of the minify css methods inside the project …
Browse files Browse the repository at this point in the history
…gulpfiles
  • Loading branch information
141512114 committed Jul 9, 2024
1 parent 884ec58 commit d0c526a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
27 changes: 15 additions & 12 deletions projects/pixle-game/gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,21 @@ Uglify / Clean CSS: ----------------------------------------------
async function uglifyCSS(dest) {
'use strict';
console.log("Minify css files...");
return gulp.src(`${dest}**/!(*.min).css`)
.pipe(plumber())
.pipe(cleanCSS({ debug: true }, (details) => {
console.log(`Original Size : ${details.name} : ${details.stats.originalSize} bytes`);
console.log(`Minified Size : ${details.name} : ${details.stats.minifiedSize} bytes`);
}))
.pipe(rename((path) => {
if (!path.extname.endsWith('.map')) {
path.basename += '.min';
}
}))
.pipe(gulp.dest(dest));
return new Promise((resolve) => {
gulp.src(`${dest}**/!(*.min).css`)
.pipe(plumber())
.pipe(cleanCSS({ debug: true }, (details) => {
console.log(`Original Size : ${details.name} : ${details.stats.originalSize} bytes`);
console.log(`Minified Size : ${details.name} : ${details.stats.minifiedSize} bytes`);
}))
.pipe(rename((path) => {
if (!path.extname.endsWith('.map')) {
path.basename += '.min';
}
}))
.pipe(gulp.dest(dest))
.on('end', resolve);
});
}

/*
Expand Down
28 changes: 16 additions & 12 deletions projects/pixle-landing/gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,22 @@ Uglify / Clean CSS: ----------------------------------------------

async function uglify(dest) {
'use strict';
return gulp.src(`${dest}**/!(*.min).css`)
.pipe(plumber())
.pipe(cleanCSS({ debug: true }, (details) => {
console.log(`Original Size : ${details.name} : ${details.stats.originalSize} bytes`);
console.log(`Minified Size : ${details.name} : ${details.stats.minifiedSize} bytes`);
}))
.pipe(rename((path) => {
if (!path.extname.endsWith('.map')) {
path.basename += '.min';
}
}))
.pipe(gulp.dest(dest));
console.log("Minify css files...");
return new Promise((resolve) => {
gulp.src(`${dest}**/!(*.min).css`)
.pipe(plumber())
.pipe(cleanCSS({ debug: true }, (details) => {
console.log(`Original Size : ${details.name} : ${details.stats.originalSize} bytes`);
console.log(`Minified Size : ${details.name} : ${details.stats.minifiedSize} bytes`);
}))
.pipe(rename((path) => {
if (!path.extname.endsWith('.map')) {
path.basename += '.min';
}
}))
.pipe(gulp.dest(dest))
.on('end', resolve);
});
}

/*
Expand Down

0 comments on commit d0c526a

Please sign in to comment.