-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
35 lines (31 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
const gulp = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const sourcemaps = require('gulp-sourcemaps');
const uglify = require('gulp-uglify');
const obfuscate = require('gulp-obfuscate');
const imagemin = require('gulp-imagemin');
function comprimeImagens() {
return gulp.src('./source/images/*')
.pipe(imagemin())
.pipe(gulp.dest('./build/images'));
}
function comprimeJavaScript() {
return gulp.src('./source/scripts/*.js')
.pipe(uglify())
.pipe(obfuscate())
.pipe(gulp.dest('./build/scripts'))
}
function compilaSass() {
return gulp.src('./source/styles/main.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'compressed'
}))
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('./build/styles'));
}
exports.default = function() {
gulp.watch('./source/styles/*.scss', { ignoreInitial: false }, gulp.series(compilaSass));
gulp.watch('./source/scripts/*.js', { ignoreInitial: false }, gulp.series(comprimeJavaScript));
gulp.watch('./source/images/*', { ignoreInitial: false }, gulp.series(comprimeImagens));
}