oliverbooth.dev/Gulpfile.js

29 lines
864 B
JavaScript
Raw Normal View History

2023-08-04 12:45:10 +01:00
const gulp = require('gulp');
const sass = require('gulp-sass')(require('node-sass'));
const cleanCSS = require('gulp-clean-css');
const rename = require('gulp-rename');
2023-08-04 12:55:16 +01:00
const ts = require('gulp-typescript');
const terser = require('gulp-terser');
2023-08-04 12:45:10 +01:00
2023-08-04 12:55:16 +01:00
const srcDir = 'src';
const destDir = 'oliverbooth.dev/wwwroot';
2023-08-04 12:45:10 +01:00
function compileSCSS() {
2023-08-04 12:55:16 +01:00
return gulp.src(`${srcDir}/scss/**/*.scss`)
2023-08-04 12:45:10 +01:00
.pipe(sass().on('error', sass.logError))
.pipe(cleanCSS({ compatibility: 'ie11' }))
.pipe(rename({ suffix: '.min' }))
2023-08-04 12:55:16 +01:00
.pipe(gulp.dest(`${destDir}/css`));
}
function compileTS() {
return gulp.src(`${srcDir}/ts/**/*.ts`)
.pipe(ts())
.pipe(terser())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(`${destDir}/js`));
2023-08-04 12:45:10 +01:00
}
exports.default = compileSCSS;
2023-08-04 12:55:16 +01:00
exports.default = gulp.parallel(compileSCSS, compileTS);