-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgulpfile.js
86 lines (79 loc) · 1.7 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
77
78
79
80
81
82
83
84
85
86
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
// jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
cache = require('gulp-cache'),
// livereload = require('gulp-livereload'),
del = require('del');
var directories = {
assets: {
js: 'assets',
},
build: {
js: 'build',
},
dist: {
js: 'dist',
},
public: {
js: 'public',
},
root: {
js: 'js',
},
resources: {
js: 'src'
}
}
var _name = 'jquery.cloner.js';
/*
| # Scripts
|
| The js files to be concatinated
| and saved to different folders.
|
| @run gulp scripts
|
*/
gulp.task('scripts', function () {
return gulp.src(directories.resources.js + '/*.js')
.pipe(concat(_name))
.pipe(gulp.dest(directories.dist.js))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
// .pipe(gulp.dest(directories.js.build))
.pipe(gulp.dest(directories.dist.js))
.pipe(notify({ message: 'Completed compiling JS Files' }));
});
/*
| # Clean
|
| @run gulp clean
*/
gulp.task('clean', function () {
return del(['js']);
});
/*
| # Default Task
|
| @run gulp default
*/
gulp.task('default', ['clean'], function () {
gulp.start('scripts');
});
/*
| # Watcher
|
| @run gulp watch
*/
gulp.task('watch', function () {
// Create LiveReload server
// livereload.listen();
// Watch any files in , reload on change
// gulp.watch(['**']).on('change', livereload.changed);
// Watch .js files
gulp.watch(directories.resources + '/**/*.js', ['scripts']);
});