-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexemplo-gulpfile.js
41 lines (33 loc) · 983 Bytes
/
exemplo-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
/**
* GulpFile Example
* Source: https://gist.github.com/gabrielfroes/f9873eb0a440641a45caa9888f774d12
* YouTube: https://www.youtube.com/watch?v=jsF1PeCxXqM
*/
// $ sudo npm install -g gulp
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
// salvar dependencias no --save-dev
// $ sudo npm install -D gulp gulp-plumber gulp-uglify gulp-concat gulp-rename
// Source Path
var js_src = "./src/js/*.js";
// Dist Path
var js_dist = "./js/";
var js_dist_name = "scripts.js";
// Minify e Concat Scripts
gulp.task('scripts', function() {
return gulp.src(js_src)
.pipe(plumber())
.pipe(uglify())
.pipe(concat(js_dist_name))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(js_dist));
});
// Watch
gulp.task('watch', function() {
gulp.watch([js_src], ['scripts']);
});
// Default
gulp.task('default', ['scripts']);