43 lines
874 B
JavaScript
43 lines
874 B
JavaScript
'use strict';
|
|
|
|
const gulp = require('gulp');
|
|
const babel = require('gulp-babel');
|
|
const eslint = require('gulp-eslint');
|
|
const sass = require('gulp-sass');
|
|
|
|
const paths = ['src/**/*.js'];
|
|
const cssPaths = {
|
|
src: './public/css/**/*.scss',
|
|
dest: './public/css',
|
|
};
|
|
|
|
gulp.task('default', ['build']);
|
|
|
|
gulp.task('watch', ['build'], () => {
|
|
gulp.watch(paths, ['build']);
|
|
});
|
|
|
|
gulp.task('build', ['sass', 'babel']);
|
|
|
|
gulp.task('lint', () => {
|
|
gulp.src(paths)
|
|
.pipe(eslint())
|
|
.pipe(eslint.format())
|
|
.pipe(eslint.failAfterError());
|
|
});
|
|
|
|
gulp.task('sass', () =>
|
|
gulp.src(cssPaths.src)
|
|
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
|
|
.pipe(gulp.dest(cssPaths.dest)));
|
|
|
|
gulp.task('sass:watch', () => {
|
|
gulp.watch(cssPaths.src, ['sass']);
|
|
});
|
|
|
|
gulp.task('babel', () => {
|
|
gulp.src(paths)
|
|
.pipe(babel())
|
|
.pipe(gulp.dest('build'));
|
|
});
|