-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·72 lines (65 loc) · 1.92 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
var gulp = require('gulp'),
uglify = require('gulp-uglifyjs'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps'),
watch = require('gulp-watch'),
browserSync = require('browser-sync');
var paths = {
ext: [
'src/assets/scripts/externals/jquery-2.2.0.min.js'
],
app: [
'src/assets/scripts/app/app.js'
],
styles: [
'src/assets/styles/styles.scss'
]
};
// Start Server
gulp.task('browser-sync', function() {
browserSync({
proxy : 'http://localhost',
port : 3001
});
});
// Scripts Task
gulp.task('externals', function() {
return gulp.src(paths.ext)
.pipe(uglify('ext.min.js'))
.pipe(gulp.dest('./src/assets/scripts/'));
});
gulp.task('scripts', function(){
gulp.src(paths.app)
.pipe(uglify('app.min.js', {
outSourceMap : true,
sourceRoot : '../../',
mangle : false,
output : {
comments: function (node, comment) {
if (/^\*\*/.test(comment.value) && /\*\*$/.test(comment.value)) {
return true;
}
}
}
}))
.pipe(gulp.dest('./src/assets/scripts/'))
.pipe(browserSync.stream());
});
// Styles Task
gulp.task('styles', function() {
gulp.src(paths.styles)
//.pipe(sourcemaps.init())
.pipe(sass({
errLogToConsole : true,
outputStyle : 'compressed'
}))
//.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./src/assets/styles/'))
.pipe(browserSync.stream());
});
// Run All Tasks
gulp.task('default', ['browser-sync','externals','scripts','styles'], function () {
gulp.watch(paths.app, ['scripts']);
gulp.watch('src/assets/styles/**/*.scss', ['styles']);
gulp.watch('src/*.html', browserSync.reload);
});