Skip to content

Commit

Permalink
chore: move Gulp tasks for SCSS transpile, moving assets to esbuild
Browse files Browse the repository at this point in the history
I think migrating to esbuild over time *could* help mitigate some
issues, the most notable one being the weird requirement for a network
connection to build PrivacySpy (which is ridiculous in general).

deps:
  • Loading branch information
doamatto committed Jan 22, 2025
1 parent 8815a52 commit 11f35ee
Show file tree
Hide file tree
Showing 10 changed files with 4,140 additions and 2,859 deletions.
47 changes: 0 additions & 47 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
} from "./src/build/utils";

const gulp = require("gulp");
const postcss = require("gulp-postcss");
const fs = require("node:fs");
const path = require("node:path");
const through = require("through2");
Expand Down Expand Up @@ -95,57 +94,11 @@ gulp.task(
)
);

gulp.task("collect dependencies", () => {
return gulp
.src(["./node_modules/lunr/lunr.min.js"])
.pipe(gulp.dest("./dist/static/deps/"));
});

gulp.task("collect static", () => {
return gulp
.src([
"./src/static/**/*",
"./node_modules/@fortawesome/fontawesome-free/**/*.{woff2,woff}",
"!./src/static/**/*.{css,scss}",
])
.pipe(gulp.dest("./dist/static/"));
});

gulp.task("collect root favicon", () => {
return gulp.src(["./src/static/img/*.ico"]).pipe(gulp.dest("./dist/"));
});

gulp.task("collect product icons", () => {
return gulp.src(["./icons/**/*"]).pipe(gulp.dest("./dist/static/icons/"));
});

gulp.task("build css", () => {
return gulp
.src(["./src/static/css/base.scss"])
.pipe(postcss())
.pipe(through.obj((file, _, cb) => { // change to .css extension
if (file.isBuffer()) {
const fp = path.format({
dir: path.dirname(file.path),
name: path.basename(file.path, ".scss"),
ext: '.css'
})
}
cb(null, file);
}))
.pipe(gulp.dest("./dist/static/css/"));
});

gulp.task(
"default",
gulp.series([
"clean",
"build pages",
"collect dependencies",
"collect static",
"collect product icons",
"collect root favicon",
"build css",
])
);

Expand Down
Loading

0 comments on commit 11f35ee

Please sign in to comment.