You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
887 B
JavaScript
32 lines
887 B
JavaScript
const {src, dest, watch, series, task} = require('gulp');
|
|
const sass = require('gulp-sass');
|
|
const ts = require('gulp-typescript');
|
|
const del = require('delete');
|
|
const cleanCss = require('gulp-clean-css');
|
|
|
|
function clearDist(cb) {
|
|
del('dist/*', cb);
|
|
}
|
|
|
|
function compileTypescript() {
|
|
let tsProject = ts.createProject('tsconfig.json');
|
|
let tsResult = tsProject.src().pipe(tsProject());
|
|
return tsResult
|
|
.pipe(dest('dist'));
|
|
}
|
|
|
|
function compileSass() {
|
|
return src('src/styles/*.sass')
|
|
.pipe(sass())
|
|
.pipe(cleanCss())
|
|
.pipe(dest('dist/styles'));
|
|
}
|
|
|
|
task('cleanBuild', series(clearDist, compileTypescript, compileSass));
|
|
task('default', series(compileTypescript, compileSass));
|
|
task('watch', () => {
|
|
series(compileSass, compileTypescript);
|
|
watch('src/**/*.sass', series(compileSass));
|
|
watch('**/*.ts', compileTypescript);
|
|
});
|