gulp: Fail prod build as well on error

pull/9822/head
Benedikt Werner 2021-09-17 04:41:55 +02:00
parent 46c8f4e126
commit c4fabeee3e
No known key found for this signature in database
GPG Key ID: 1DBFF0F8E9E121EB
1 changed files with 6 additions and 6 deletions

View File

@ -22,6 +22,10 @@ const destination = () => gulp.dest('../public/css/');
const sourcesGlob = './*/css/**/*.scss';
const buildsGlob = './*/css/build/*.scss';
const onSassError = err => {
throw new PluginError('sass', err.messageFormatted, { showProperties: false });
};
const build = () =>
gulp
.src(sourcesGlob)
@ -32,11 +36,7 @@ const build = () =>
//filter out internal imports (folders and files starting with "_" )
.pipe(filter(file => !/\/_/.test(file.path) || !/^_/.test(file.relative)))
.pipe(sourcemaps.init())
.pipe(
sass(sassOptions).on('error', err => {
throw new PluginError('sass', err.messageFormatted, { showProperties: false });
})
)
.pipe(sass(sassOptions).on('error', onSassError))
.pipe(sourcemaps.write())
.pipe(renameAs('dev'))
.pipe(destination());
@ -57,7 +57,7 @@ gulp.task('css-prod', () =>
sass({
...sassOptions,
...{ outputStyle: 'compressed' },
}).on('error', sass.logError)
}).on('error', onSassError)
)
.pipe(autoprefixer())
.pipe(renameAs('min'))