-
Notifications
You must be signed in to change notification settings - Fork 45
/
gulpfile.js
53 lines (46 loc) · 1.2 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
const gulp = require('gulp'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
cleanCss = require('gulp-clean-css'),
chmod = require('gulp-chmod'),
clean = require('gulp-clean'),
replace = require('gulp-replace')
gulp.task('assets:css', () => {
return gulp.src('src/password.css')
.pipe(cleanCss())
.pipe(rename({
extname: '.min.css'
}))
.pipe(chmod(0o664))
.pipe(gulp.dest('./dist'))
})
gulp.task('assets:img', () => {
return gulp.src('src/passwordstrength.jpg')
.pipe(chmod(0o664))
.pipe(gulp.dest('./dist'))
})
gulp.task('assets:js', () => {
return gulp.src('src/password.js')
.pipe(uglify({
output: {
comments: 'some'
},
}))
.pipe(rename({
extname: '.min.js'
}))
.pipe(chmod(0o664))
.pipe(gulp.dest('./dist'))
})
gulp.task('clean', () => {
return gulp.src('dist/*', { read: false })
.pipe(clean())
})
function assets() {
return gulp.src('src/index.html')
.pipe(replace('./password', './password.min'))
.pipe(chmod(0o664))
.pipe(gulp.dest('./dist'))
}
gulp.task('assets', gulp.series('assets:css', 'assets:js', 'assets:img', assets))
gulp.task('default', gulp.series('assets'))