forked from turnitin/moodle-mod_turnitintooltwo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
37 lines (32 loc) · 1.13 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var minifyCss = require('gulp-clean-css');
var sourcemaps = require('gulp-sourcemaps');
var notify = require('gulp-notify');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
gulp.task('sass', function() {
return gulp.src('./sass/styles.scss')
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(minifyCss())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('.'))
.pipe(notify("CSS Compiled!"));
});
gulp.task('jsmin', function() {
return gulp.src(['./jquery/turnitintooltwo*.js', '!./jquery/turnitintooltwo*.min.js'])
.pipe(sourcemaps.init())
.pipe(uglify().on('error', function(e){
console.log(e);
}))
.pipe(rename({suffix: '.min'}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./jquery/'))
.pipe(notify('js minified'));
});
gulp.task('watch', function() {
gulp.watch('./sass/**/*.scss', gulp.series('sass'));
gulp.watch('./jquery/turnitintooltwo*.js', gulp.series('jsmin'));
});
gulp.task('default', gulp.series(['sass', 'jsmin', 'watch']));