forked from olifolkerd/tabulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
92 lines (80 loc) · 2.81 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
cache = require('gulp-cache'),
livereload = require('gulp-livereload'),
del = require('del');
include = require('gulp-include'),
sourcemaps = require('gulp-sourcemaps'),
babel = require('gulp-babel'),
plumber = require('gulp-plumber'),
gutil = require('gulp-util');
var gulp_src = gulp.src;
gulp.src = function() {
return gulp_src.apply(gulp, arguments)
.pipe(plumber(function(error) {
// Output an error message
gutil.log(gutil.colors.red('Error (' + error.plugin + '): ' + error.message));
// emit the end event, to properly end the task
this.emit('end');
})
);
};
gulp.task('styles', function() {
return gulp.src('src/scss/**/tabulator*.scss')
.pipe(sourcemaps.init())
.pipe(sass({outputStyle: 'expanded'}).on('error', sass.logError))
.pipe(autoprefixer('last 4 version'))
.pipe(gulp.dest('dist/css'))
.pipe(rename({suffix: '.min'}))
.pipe(cssnano())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist/css'))
//.pipe(notify({ message: 'Styles task complete' }));
.on('end', function(){ gutil.log('Styles task complete'); })
});
gulp.task('scripts', function() {
//return gulp.src('src/js/**/*.js')
return gulp.src('src/js/jquery_wrapper.js')
//.pipe(sourcemaps.init())
.pipe(include())
//.pipe(jshint())
// .pipe(jshint.reporter('default'))
.pipe(babel({
//presets:['es2015']
presets: [["env", {
"targets": {
"browsers": ["last 4 versions"]
}
}]
]
}))
.pipe(concat('tabulator.js'))
.pipe(gulp.dest('dist/js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
// .pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist/js'))
//.pipe(notify({ message: 'Scripts task complete' }));
.on('end', function(){ gutil.log('Scripts task complete'); })
//.on("error", console.log)
});
gulp.task('clean', function() {
return del(['dist/css', 'dist/js']);
});
gulp.task('default', ['clean'], function() {
gulp.start('styles', 'scripts');
});
gulp.task('watch', function() {
// Watch .scss files
gulp.watch('src/scss/**/*.scss', ['styles']);
// Watch .js files
gulp.watch('src/js/**/*.js', ['scripts']);
});