-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
76 lines (61 loc) · 1.43 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
//const gulp = require('gulp');
const { src,dest,watch,series,parallel } = require('gulp');
const imagemin = require('gulp-imagemin');
const uglify = require('gulp-uglify');
const sass = require('gulp-sass');
const concat = require('gulp-concat');
const ext_replace = require('gulp-ext-replace');
/*
~~ FLASH TIPS - MAIN TASKS ~~
gulp.task - Define task
gulp.src - Point to file to use
gulp.dest - Point to folder to output
gulp.watch - Watch files and folders for changes
*/
//Minify js
function minify(done) {
src('assets/js/*.js')
.pipe(uglify())
.pipe(dest('public/javascripts'));
done();
};
//Optimizr images
function imageMin(done) {
src('assets/images/*')
.pipe(imagemin())
.pipe(dest('public/images'));
done();
};
//Compile sass
function scss(done) {
src('assets/sass/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(dest('public/stylesheets'));
done();
};
//Scripts
function scripts(done) {
src('assets/js/*.js')
.pipe(uglify())
.pipe(dest('public/javascripts'));
done();
};
function watchTask(){
watch('assets/js/*.js', scripts);
watch('assets/images/*', imageMin);
watch('assets/sass/*.sass', scss);
//watch('assets/*.html', copyHtml);
}
exports.default = series(
parallel(
scss,
scripts,
imageMin
),
minify,
watchTask
);
// gulp.task('default', gulp.series('imageMin', 'sass', 'scripts', function(done) {
// // default task code here
// done();
// }));