-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
56 lines (52 loc) · 1.62 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var gulp = require('gulp');
//CONCAT
var concat = require('gulp-concat');
var babel = require('gulp-babel');
var uglify = require('gulp-uglify');
gulp.task('concat', function() {
return gulp.src(['./source/js/**/*.js', './source/lib/**/*.js', '!./source/js/index.js'])
.pipe(babel({
presets: ['es2015']
}))
.pipe(concat('index.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./source/js/'));
});
//CSS-Lint
var csslint = require('gulp-csslint');
var gutil = require('gulp-util');
var myCustomReporterCss = function(file) {
gutil.log(gutil.colors.cyan(file.csslint.errorCount)+' errors in '+gutil.colors.magenta(file.path));
file.csslint.results.forEach(function(result) {
gutil.log(result.error.message+' on line '+result.error.line);
});
};
gulp.task('css-lint', function() {
gulp.src('./source/sass/index.css')
.pipe(csslint())
.pipe(csslint.reporter(myCustomReporterCss));
});
//SCSS-Lint
var scsslint = require('gulp-scss-lint');
var myCustomReporterScss = function(file) {
if (!file.scsslint.success) {
gutil.log(file.scsslint.issues.length + ' issues found in ' + file.path);
}
};
gulp.task('scss-lint', function() {
return gulp.src('./source/sass/**/*.scss')
.pipe(scsslint({
customReport: myCustomReporterScss
}));
});
//SASS
var sass = require('gulp-sass');
gulp.task('sass', function () {
return gulp.src('./source/sass/**/*.scss')
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(gulp.dest('./dist/css'));
});
gulp.task('sass:watch', function () {
gulp.watch('./source/sass/**/*.scss', ['sass']);
});
gulp.task('default', ['sass']);