-
Notifications
You must be signed in to change notification settings - Fork 146
/
gulpfile.js
41 lines (35 loc) · 1023 Bytes
/
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
const gulp = require('gulp');
const uglify = require("gulp-uglify");
const cleanCss = require("gulp-clean-css");
const eslint = require("gulp-eslint");
const rename = require("gulp-rename");
const sass = require('gulp-sass');
const file = 'jquery.nestable';
// compress js
gulp.task('js', function () {
gulp.src(file + '.js')
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist/'));
});
// compile SASS to CSS
gulp.task('sass', function () {
return gulp.src(file + '.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('.'));
});
// compress css
gulp.task('css', ['sass'], function () {
gulp.src(file + '.css')
.pipe(cleanCss())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist/'));
});
gulp.task('test', function () {
return gulp.src([file + '.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
// build assets
gulp.task('default', ['js', 'css']);