frontend-tasks
Version:
Frontend Tasks is a wrapper around gulp for most of the normal use cases for simple and modern frontend development
37 lines (33 loc) • 871 B
JavaScript
import gulp from 'gulp';
import plumber from 'gulp-plumber';
import postcss from 'gulp-postcss';
import sourcemaps from 'gulp-sourcemaps';
import notify from 'gulp-notify';
import gulpIf from 'gulp-if';
import hash from '../.node/GulpHashPlugin';
import Config from '../config';
const css = (options = {}) => {
return () => {
return gulp
.src(options.src)
.pipe(
plumber({
errorHandler: function (error) {
if (Config.showNotifications) {
notify.onError({
title: Config.projectTitle + ' - CSS Error',
message: error.toString(),
})(error);
}
this.emit('end');
},
}),
)
.pipe(sourcemaps.init())
.pipe(postcss())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(options.dest))
.pipe(gulpIf(Config.versionManifest !== false, hash(Config.versionManifest)));
};
};
export default css;